diff --git a/.gitignore b/.gitignore index 091a1c1..b675066 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ pom.xml.* .idea test/resources/.compiled .cache/ +.cpcache \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 531301c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -dist: bionic -os: linux -language: clojure -notifications: - email: - - antonin@hildebrand.cz -cache: - directories: - - "$HOME/.m2" - # this is mainly for puppeteer, by default it stores chromium downloads in node_modules/puppeteer/.local-chromium - - "$TRAVIS_BUILD_DIR/test/node_modules" -before_install: - - npm i -g npm - - yes y | sudo lein upgrade - - curl -sSL https://raw.githubusercontent.com/cljs-oss/canary/master/scripts/install-canary.sh | bash - - (cd test && npm install) diff --git a/deps.edn b/deps.edn index 1e16d5f..9c797b1 100644 --- a/deps.edn +++ b/deps.edn @@ -1,3 +1,3 @@ {:paths ["src/lib"] - :deps {org.clojure/clojure {:mvn/version "1.10.1"} - org.clojure/clojurescript {:mvn/version "1.10.764"}}} + :deps {org.clojure/clojure {:mvn/version "1.11.1"} + org.clojure/clojurescript {:mvn/version "1.11.60"}}} diff --git a/docs/faq.md b/docs/faq.md index 76b511e..229891f 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -140,11 +140,6 @@ Please read [installation.md#advanced-builds][13]. No, AFAIK. -### What else can I do to improve my ClojureScript development experience? - -Check out [Dirac DevTools][8] which is -a custom fork of Chrome DevTools which goes one or two steps further. - [1]: http://www.html5rocks.com/en/tutorials/developertools/async-call-stack [2]: https://github.com/clojure/core.async [3]: https://box.binaryage.com/core-async-long-stack-traces.png diff --git a/docs/installation.md b/docs/installation.md index 2aa5059..843656a 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -1,10 +1,12 @@ # CLJS DevTools Installation -## Enable Custom formatters in Chrome +## Enable Custom formatters in the browser -Available in [**Chrome 47 and higher**](http://googlechromereleases.blogspot.cz/2015/12/stable-channel-update.html). +### In Chrome and Edge -~~**WARNING**: Custom formatters will be probably removed from Chrome 86 (or later).~~ +Available in [**Chrome 47 and higher**](https://googlechromereleases.blogspot.cz/2015/12/stable-channel-update.html) and **Edge 79 and higher**. + +~~**WARNING**: Custom formatters will be probably removed from Chrome 86 (or later).~~ ~~Please read recent news in [issue 55](https://github.com/binaryage/cljs-devtools/issues/55).~~ ~~Newly since Chrome 84 you have to re-enable custom formatters every time you open devtools. The setting is not sticky anymore.~~ @@ -16,7 +18,20 @@ All should work the same as before for now. If your setting is not sticky, pleas * Open DevTools * Go to Settings ("three dots" icon in the upper right corner of `DevTools > Menu > Settings F1 > Preferences > Console`) - * Check-in "Enable custom formatters" + * Check "Enable custom formatters" + * Close DevTools + * Open DevTools + +Note: You might need to refresh the page first time you open Console panel with existing logs - custom formatters are applied +only to newly printed console messages. + +### In Firefox + +Available in [**Firefox 111 and higher**](https://www.mozilla.org/en-US/firefox/111.0/releasenotes/). + + * Open DevTools + * Go to Settings ("three dots" icon in the upper right corner of `DevTools > Menu > Settings F1 > Advanced settings`) + * Check "Enable custom formatters" * Close DevTools * Open DevTools diff --git a/examples/deps/public/index.html b/examples/deps/public/index.html index 360721a..98fcf41 100644 --- a/examples/deps/public/index.html +++ b/examples/deps/public/index.html @@ -9,8 +9,8 @@
-1. Please open Chrome DevTools (CMD+OPT+I / CTRL+SHIFT+I) -2. Enable custom formatters in DevTools -> Settings -> Console -> Enable custom formatters +1. Please open Chrome, Edge or Firefox DevTools (CMD+OPT+I / CTRL+SHIFT+I) +2. Enable custom formatters in DevTools -> Settings -> Console / Advanced settings -> Enable custom formatters 3. Refresh the page and see output in the DevTools Consolediff --git a/examples/lein/project.clj b/examples/lein/project.clj index 54943f5..b0b2ca5 100644 --- a/examples/lein/project.clj +++ b/examples/lein/project.clj @@ -6,7 +6,7 @@ :dependencies [[org.clojure/clojure "1.10.1"] [org.clojure/clojurescript "1.10.764"] [org.clojure/core.async "1.2.603"] - [binaryage/devtools "1.0.2"] + [binaryage/devtools "1.0.7"] [binaryage/dirac "RELEASE"] [com.cognitect/transit-clj "1.0.324"] [cljs-http "0.1.46"] diff --git a/examples/lein/readme.md b/examples/lein/readme.md index a4bf597..5254a11 100644 --- a/examples/lein/readme.md +++ b/examples/lein/readme.md @@ -17,7 +17,7 @@ Build the project and start a local demo server: Wait for compilation and when figwheel fully starts: * A demo page should be available at [http://localhost:7000](http://localhost:7000). - * Please visit it with Google Chrome browser with [enabled custom formatters](https://github.com/binaryage/cljs-devtools). + * Please visit it with Google Chrome, Microsoft Edge or Mozilla Firefox browser with [enabled custom formatters](https://github.com/binaryage/cljs-devtools). * Open the web development console under devtools and you should see something similar to the screenshot above. Note: you might need to refresh the page again to force re-rendering of custom formatters after opening the console. diff --git a/examples/shadow/public/index.html b/examples/shadow/public/index.html index 647dd7f..cb6b9cf 100644 --- a/examples/shadow/public/index.html +++ b/examples/shadow/public/index.html @@ -9,8 +9,8 @@
-1. Please open Chrome DevTools (CMD+OPT+I / CTRL+SHIFT+I) -2. Enable custom formatters in DevTools -> Settings -> Console -> Enable custom formatters +1. Please open Chrome, Edge or Firefox DevTools (CMD+OPT+I / CTRL+SHIFT+I) +2. Enable custom formatters in DevTools -> Settings -> Console / Advanced settings -> Enable custom formatters 3. Refresh the page and see output in the DevTools Consolediff --git a/project.clj b/project.clj index a7ea0f5..1c08067 100644 --- a/project.clj +++ b/project.clj @@ -1,6 +1,6 @@ -(def clojurescript-version (or (System/getenv "CANARY_CLOJURESCRIPT_VERSION") "1.10.764")) -(defproject binaryage/devtools "1.0.2" - :description "A collection of Chrome DevTools enhancements for ClojureScript developers." +(def clojurescript-version (or (System/getenv "CANARY_CLOJURESCRIPT_VERSION") "1.11.60")) +(defproject binaryage/devtools "1.0.7" + :description "A collection of Chrome, Edge and Firefox DevTools enhancements for ClojureScript developers." :url "https://github.com/binaryage/cljs-devtools" :license {:name "MIT License" :url "http://opensource.org/licenses/MIT" @@ -9,7 +9,7 @@ :scm {:name "git" :url "https://github.com/binaryage/cljs-devtools"} - :dependencies [[org.clojure/clojure "1.10.1" :scope "provided"] + :dependencies [[org.clojure/clojure "1.11.1" :scope "provided"] [org.clojure/clojurescript ~clojurescript-version :scope "provided"]] :clean-targets ^{:protect false} ["target" @@ -163,11 +163,11 @@ "compare-dead-code-with-pseudo-names" ["shell" "scripts/compare-dead-code.sh" "+testing,+dce-pseudo-names"] "test-tests" ["do" ["with-profile" "+testing" "cljsbuild" "once" "tests"] - ["shell" "node" "test/resources/puppeteer.js" "test/resources" "run-tests.html"]] + ["shell" "node" "--no-deprecation" "test/resources/puppeteer.js" "test/resources" "run-tests.html"]] "test-tests-with-config" ["do" ["shell" "scripts/compile-tests-with-config.sh"] - ["shell" "node" "test/resources/puppeteer.js" "test/resources" "run-tests-with-config.html"]] + ["shell" "node" "--no-deprecation" "test/resources/puppeteer.js" "test/resources" "run-tests-with-config.html"]] "test-advanced-warning" ["do" ["with-profile" "+testing" "cljsbuild" "once" "advanced-warning"] - ["shell" "node" "test/resources/puppeteer.js" "test/resources" "run-advanced-warning.html"]] + ["shell" "node" "--no-deprecation" "test/resources/puppeteer.js" "test/resources" "run-advanced-warning.html"]] "release" ["shell" "scripts/release.sh"]}) diff --git a/readme.md b/readme.md index 1039b40..fd56136 100644 --- a/readme.md +++ b/readme.md @@ -2,12 +2,11 @@ [](license.txt) [](https://clojars.org/binaryage/devtools) -[](https://travis-ci.org/binaryage/cljs-devtools) [](https://github.com/binaryage/cljs-devtools/tree/master/examples) -CLJS DevTools adds enhancements into Chrome DevTools for ClojureScript developers: +CLJS DevTools adds enhancements into Chrome, Edge and Firefox DevTools for ClojureScript developers: -* Better presentation of ClojureScript values in Chrome DevTools (see the [:formatters][1] feature) +* Better presentation of ClojureScript values in DevTools (see the [:formatters][1] feature) * More informative exceptions (see the [:hints][2] feature) * Long stack traces for chains of async calls (see the [:async][3] feature) @@ -26,12 +25,6 @@ CLJS DevTools adds enhancements into Chrome DevTools for ClojureScript developer  ---- - -## What next? - - * [Dirac DevTools](https://github.com/binaryage/dirac) - [1]: https://github.com/binaryage/cljs-devtools/blob/master/docs/faq.md#what-is-the-formatters-feature [2]: https://github.com/binaryage/cljs-devtools/blob/master/docs/faq.md#what-is-the-hints-feature [3]: https://github.com/binaryage/cljs-devtools/blob/master/docs/faq.md#what-is-the-async-feature diff --git a/src/lib/devtools/async.cljs b/src/lib/devtools/async.cljs index 5fd5b09..fc8a538 100644 --- a/src/lib/devtools/async.cljs +++ b/src/lib/devtools/async.cljs @@ -1,7 +1,7 @@ (ns devtools.async (:require-macros [devtools.oops :refer [oset ocall]]) (:require [goog.async.nextTick] - [goog.labs.userAgent.browser :as ua] + [goog.labs.userAgent.browser :refer [isChrome isVersionOrHigher]] [devtools.context :as context])) (defn ^:dynamic available? [] @@ -10,7 +10,7 @@ (def ^:dynamic fixed-chrome-version-for-async "65.0.3321") (defn ^:dynamic needed? [] - (not (and (ua/isChrome) (ua/isVersionOrHigher fixed-chrome-version-for-async)))) + (not (and (isChrome) (isVersionOrHigher fixed-chrome-version-for-async)))) (defn ^:dynamic get-not-needed-message [] (str "cljs-devtools: the :async feature is no longer needed since Chrome " fixed-chrome-version-for-async ", " diff --git a/src/lib/devtools/defaults.clj b/src/lib/devtools/defaults.clj index 9099745..160d0dd 100644 --- a/src/lib/devtools/defaults.clj +++ b/src/lib/devtools/defaults.clj @@ -121,7 +121,7 @@ (defmacro get-common-type-header-style [] `(css (str "color: " (named-color :type-text) ";") "padding: 0px 2px 0px 2px;" - "-webkit-user-select: none;")) + "user-select: none;")) (defmacro get-inner-background-style [] `(css "position: absolute;" @@ -152,7 +152,7 @@ `(css "position: relative;" "padding: 0px 4px;" "border-radius: 2px;" - "-webkit-user-select: none;")) + "user-select: none;")) ; -- style macros ----------------------------------------------------------------------------------------------------------- @@ -171,7 +171,7 @@ "position: relative;" "margin-right: 3px;" "border-radius: 2px;" - "-webkit-user-select: none;" + "user-select: none;" (if (= ~kind :slim) "padding: 0px 4px; top:2px;" "padding: 1px 4px; top:1px;"))) diff --git a/src/lib/devtools/defaults.cljs b/src/lib/devtools/defaults.cljs index f3a34cf..4e1f5ed 100644 --- a/src/lib/devtools/defaults.cljs +++ b/src/lib/devtools/defaults.cljs @@ -18,6 +18,7 @@ :bypass-availability-checks false :disable-advanced-mode-check false :file-reader nil + :dont-detect-custom-formatters true ; the detector is flaky in recent chrome versions ; -- feature tweaks ---------------------------------------------------------------------------------------------------- @@ -83,6 +84,7 @@ "cljs.core/PersistentTreeSet" "cljs.core/MapEntry" "cljs.core/Range" + "cljs.core/IntegerRange" "cljs.core/ES6IteratorSeq" "cljs.core/Eduction" "cljs.core/UUID" @@ -321,7 +323,7 @@ "border-radius: 0 2px 2px 0;") :meta-style (css (str "color: " (named-color :meta-text) ";") "padding: 0px 3px;" - "-webkit-user-select: none;") + "user-select: none;") :meta-body-style (css (str "background-color: " (named-color :meta 0.1) ";") (str "box-shadow: 0px 0px 0px 1px " (named-color :meta) " inset;") "position: relative;" @@ -361,7 +363,7 @@ "border-radius: 2px;" "padding: 0px 4px 0px 4px;" "margin: 1px 0px 0px 0px;" - "-webkit-user-select: none;") + "user-select: none;") :body-style (css "display: inline-block;" "padding: 3px 12px;" (str "border-top: 2px solid " (named-color :body-border) ";") @@ -378,7 +380,7 @@ "margin-right: 3px;" "padding: 0px 4px 0px 4px;" "margin: 1px 0px 0px 0px;" - "-webkit-user-select: none;") + "user-select: none;") :expanded-string-style (css "padding: 0px 12px 0px 12px;" (str "color: " (named-color :string) ";") "white-space: pre;" @@ -399,3 +401,28 @@ ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ })) + +; this config gets merged over defaults when Firefox is detected +; see https://github.com/binaryage/cljs-devtools/pull/73 +(def firefox-overrides-config + (delay + {:native-reference-wrapper-style (css "line-height: 0;" + "margin-top: -1px;") + :symbol-style (css "overflow: initial;") + :fn-header-style (css "display: inline-flex;" + "align-items: center;") + :type-ref-style (css (str "background-color:" (named-color :type) ";") + "border-radius: 0 2px 2px 0;") + :native-reference-style (css "padding: 0px 3px;" + "position: relative;" + "top: 1px;") + :standard-li-style (css "margin-left: 0px;" + "display: flex;" + "align-items: start;") + :standard-li-no-margin-style (css "margin-left: 0px;" + "display: flex;" + "align-items: start;") + :aligned-li-style (css "margin-left: 0px;" + "display: flex;" + "align-items: start;") + })) diff --git a/src/lib/devtools/formatters.cljs b/src/lib/devtools/formatters.cljs index 5e7d15b..3fcb7f9 100644 --- a/src/lib/devtools/formatters.cljs +++ b/src/lib/devtools/formatters.cljs @@ -1,6 +1,6 @@ (ns devtools.formatters (:require-macros [devtools.oops :refer [unchecked-aget unchecked-aset]]) - (:require [goog.labs.userAgent.browser :as ua] + (:require [goog.labs.userAgent.browser :refer [isVersionOrHigher isChrome isFirefox isEdge isEdgeChromium]] [devtools.prefs :as prefs] [devtools.util :refer [get-formatters-safe set-formatters-safe! in-node-context?]] [devtools.context :as context] @@ -13,8 +13,10 @@ (def obsolete-formatter-key "devtoolsFormatter") (defn ^:dynamic available? [] - (or (in-node-context?) ; node.js or Chrome 47+ - (and (ua/isChrome) (ua/isVersionOrHigher 47)))) + (or (in-node-context?) + (and (isChrome) (isVersionOrHigher 47)) + (and (isFirefox) (isVersionOrHigher 111)) + (and (or (isEdge) (isEdgeChromium)) (isVersionOrHigher 79)))) (deftype CLJSDevtoolsFormatter []) diff --git a/src/lib/devtools/formatters/markup.cljs b/src/lib/devtools/formatters/markup.cljs index 409bbb6..c700543 100644 --- a/src/lib/devtools/formatters/markup.cljs +++ b/src/lib/devtools/formatters/markup.cljs @@ -179,7 +179,7 @@ ;; a sequence or map as the second item when the path info is not nil. ;; are all just seq'd maps and that the first item in the vector is a key in the map. ;; The seq'd map is a result of `(seq value)` done in `body-lines` above - (devtools.formatters.state/push-object-to-current-history! value) + (devtools.formatters.state/push-object-to-current-history! (with-meta value {:index starting-index})) (let [has-continuation? (pos? starting-index) body-markup (