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 Console
 
diff --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 Console
 
diff --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 @@ [![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](license.txt) [![Clojars Project](https://img.shields.io/clojars/v/binaryage/devtools.svg)](https://clojars.org/binaryage/devtools) -[![Travis](https://img.shields.io/travis/binaryage/cljs-devtools.svg)](https://travis-ci.org/binaryage/cljs-devtools) [![Example Projects](https://img.shields.io/badge/project-examples-ff69b4.svg)](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 ![An example of hints](https://box.binaryage.com/cljs-devtools-sanity-hint.png) ---- - -## 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 ( (body-lines value starting-index) has-continuation?)] (if has-continuation? @@ -213,7 +213,7 @@ ( nil preview-markup (or details-markup default-details-fn))) preview-markup))) -; -- mete-related markup ---------------------------------------------------------------------------------------------------- +; -- meta-related markup ---------------------------------------------------------------------------------------------------- (defn [metadata] (let [body-fn (fn [] [:meta-body-tag ( metadata)]) diff --git a/src/lib/devtools/formatters/printing.cljs b/src/lib/devtools/formatters/printing.cljs index 371a6ce..a78831d 100644 --- a/src/lib/devtools/formatters/printing.cljs +++ b/src/lib/devtools/formatters/printing.cljs @@ -119,7 +119,8 @@ (defn alt-printer-impl [obj writer opts] (binding [*current-state* (get-current-state)] - (add-object-to-current-path-info! obj) + (when (pref :render-path-annotations) + (add-object-to-current-path-info! obj)) (let [{:keys [markup-db]} opts circular? (is-circular? obj) inner-writer (make-template-writer (:markup-db opts)) diff --git a/src/lib/devtools/formatters/state.cljs b/src/lib/devtools/formatters/state.cljs index 4ed279f..5a36b60 100644 --- a/src/lib/devtools/formatters/state.cljs +++ b/src/lib/devtools/formatters/state.cljs @@ -49,29 +49,41 @@ (defn get-second-last-object-from-current-history [] (second (get-current-history))) ; note the list is reversed -(defn present-path-segment [v] +(defn present-path-segment [v & [starting-index]] (cond (string? v) v ;; we'd like to preserve keywords for easy get (keyword? v) v + (and (number? v) + (number? starting-index)) (+ v starting-index) ;; ensures indexing in very large objects (number? v) v :else "?")) -(defn seek-path-segment [coll val] - (let [* (fn [[k v]] - (cond - ;; we need to know the paths for keywords, these are clickable - (identical? k val) - (present-path-segment k) - - (identical? v val) - (present-path-segment k)))] +(defn seek-path-segment [coll val & [seq'd-map?]] + (let [starting-index (-> (get-last-object-from-current-history) + (meta) + :index) + * (fn [[k v]] + (cond + ;; we need to know the paths for keywords, these are clickable + (and seq'd-map? (identical? k val)) + (present-path-segment k) + + (identical? v val) + (present-path-segment k starting-index)))] (some * coll))) (defn build-path-segment [parent-object object] (cond - (map? parent-object) (seek-path-segment (seq parent-object) object) - (sequential? parent-object) (seek-path-segment (map-indexed (fn [i x] [i x]) parent-object) object))) + (map? parent-object) (seek-path-segment (seq parent-object) object true) + (sequential? parent-object) (seek-path-segment (map-indexed (fn [i x] [i x]) parent-object) object) + (and (set? parent-object) + (contains? parent-object object) + (or (string? object) + (keyword? object) + (integer? object))) object ;; if set has the simple object, return the object instead. + (and (set? parent-object) ;; in composite objects in sets, return the index in the set. + (contains? parent-object object)) (seek-path-segment (map-indexed (fn [i x] [i x]) parent-object) object))) ;; This function checks a unique situation of looping an immediate child element `obj` of a parent element `history` ;; say we have a general map {:a 2 :b {:gh 45} :c 4} @@ -85,33 +97,45 @@ ;; get the first item in the vector which is the path. (defn mapping? [history obj] - (let [obj-kw (when (and (vector? obj) - (= (count obj) 2) - ;; the map keys must always be one of these - (or - (-> obj first keyword?) - (-> obj first string?) - (-> obj first number?))) - (first obj))] - (when (and (map? history) obj-kw) - (contains? history obj-kw)))) + (let [first-kw (when (and (vector? obj) + (map? history)) + (nth obj 0 nil)) + valid-kw? (and first-kw + (or (keyword? first-kw) + (string? first-kw) + (number? first-kw)) + ;; intentionally delaying realizing the whole vector + (= (count obj) 2))] + (when valid-kw? + (contains? history first-kw)))) + +(defn ignore-path-in-fake-vector + [history obj path] + ;; if the current item we are looping at is an artificial vector (explained at `mapping` above), + ;; don't append to the path + (when (mapping? history obj) + (or path []))) + +(defn find-path-in-fake-vector + [history path] + (let [second-last-history (get-second-last-object-from-current-history)] + ;; if the previous item is an artificial vector, lets append to the path info but take the first item + ;; in the artificial vector as the path. (Explained in `mapping` above) + (when (mapping? second-last-history history) + (conj (or path []) (nth history 0 nil))))) + +(defn find-path + [history obj path] + (let [path-segment (build-path-segment history obj)] + (when (some? path-segment) + (conj (or path []) path-segment)))) (defn extend-path-info [path-info object] (let [parent-object (get-last-object-from-current-history)] - (cond - ;; if the current item we are looping at is an artificial vector (explained at `mapping` above), - ;; dont append to the path - (and (map? parent-object) (mapping? parent-object object)) - path-info - ;; if the previous item is an artificial vector, lets append to the path info but take the first item - ;; in the vector as the path. (Explained in `mapping` above) - (and (map? (get-second-last-object-from-current-history)) - (mapping? (get-second-last-object-from-current-history) parent-object)) - (conj (or path-info []) (first parent-object)) - ;; the current object is an item within the parent object - (some? (build-path-segment parent-object object)) - (conj (or path-info []) (build-path-segment parent-object object)) - :else path-info))) + (or (ignore-path-in-fake-vector parent-object object path-info) + (find-path-in-fake-vector parent-object path-info) + (find-path parent-object object path-info) + path-info))) (defn add-object-to-current-path-info! [object] (update-current-state! update :path-info extend-path-info object)) diff --git a/src/lib/devtools/prefs.cljs b/src/lib/devtools/prefs.cljs index a75a30e..c334cbc 100644 --- a/src/lib/devtools/prefs.cljs +++ b/src/lib/devtools/prefs.cljs @@ -1,11 +1,13 @@ (ns devtools.prefs (:require-macros [devtools.prefs :refer [emit-external-config]]) - (:require [devtools.defaults :as defaults])) + (:require [goog.labs.userAgent.browser :refer [isFirefox]] + [devtools.defaults :as defaults])) ; we use delay for DCE, see https://github.com/binaryage/cljs-devtools/issues/37 (def default-config (delay @defaults/config)) +(def firefox-overrides-config (delay (if (isFirefox) @defaults/firefox-overrides-config))) (def external-config (delay (emit-external-config))) -(def initial-config (delay (merge @default-config @external-config))) +(def initial-config (delay (merge @default-config @firefox-overrides-config @external-config))) (def ^:dynamic *current-config* (delay @initial-config)) diff --git a/src/lib/devtools/util.cljs b/src/lib/devtools/util.cljs index 4db3b98..0a57e74 100644 --- a/src/lib/devtools/util.cljs +++ b/src/lib/devtools/util.cljs @@ -1,7 +1,7 @@ (ns devtools.util (:require-macros [devtools.oops :refer [oget ocall oset unchecked-aget unchecked-aset]] [devtools.compiler :refer [check-compiler-options!]]) - (:require [goog.userAgent :as ua] + (:require [goog.userAgent :refer [getUserAgentString]] [clojure.data :as data] [devtools.version :refer [get-current-version]] [devtools.context :as context] @@ -62,7 +62,7 @@ (defn ^:dynamic get-js-context-description [] (if-let [node-info (get-node-info (context/get-root))] (str "node/" (get-node-description node-info)) - (let [user-agent (ua/getUserAgentString)] + (let [user-agent (getUserAgentString)] (if (empty? user-agent) "" user-agent)))) diff --git a/src/lib/devtools/version.clj b/src/lib/devtools/version.clj index 65852e4..15a9f9b 100644 --- a/src/lib/devtools/version.clj +++ b/src/lib/devtools/version.clj @@ -1,6 +1,6 @@ (ns devtools.version) -(def current-version "1.0.2") ; this should match our project.clj +(def current-version "1.0.7") ; this should match our project.clj (defmacro get-current-version [] current-version) diff --git a/test/.gitignore b/test/.gitignore index 239ecff..22fbdbe 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -1,2 +1,3 @@ node_modules yarn.lock +package-lock.json diff --git a/test/package.json b/test/package.json index 321c07e..6e1a32d 100644 --- a/test/package.json +++ b/test/package.json @@ -4,9 +4,7 @@ "license": "MIT", "private": true, "devDependencies": { - "puppeteer": "^2.1.0", - "http-server": "^0.12.1" - }, - "dependencies": { + "http-server": "^13.0.2", + "puppeteer": "^10.4.0" } } diff --git a/test/src/tests/devtools/tests/core.cljs b/test/src/tests/devtools/tests/core.cljs index 09dd18f..1ea0b27 100644 --- a/test/src/tests/devtools/tests/core.cljs +++ b/test/src/tests/devtools/tests/core.cljs @@ -89,8 +89,6 @@ :dont-display-formatters-removal-warning true} (clear-captured-console-output!) (devtools/install! :all) - (is (= (count (get-captured-console-messages)) 1)) - (is (every? #(not (re-matches #".*cannot be installed.*" %)) (rest (get-captured-console-messages)))) (is (= (devtools/installed? :all) true)) (is (= (devtools/installed? :formatters) true)) (is (= (devtools/installed? :hints) true)) diff --git a/test/src/tests/devtools/tests/format.cljs b/test/src/tests/devtools/tests/format.cljs index 9898a70..0831250 100644 --- a/test/src/tests/devtools/tests/format.cljs +++ b/test/src/tests/devtools/tests/format.cljs @@ -1093,22 +1093,26 @@ (deftest test-issue-56 (testing "render path annotations" (with-prefs {:render-path-annotations true} - (let [m {:k1 {:k2 "val"}}] + (let [k1 :k1 + k2 :k2 + m {k1 {k2 "val"}}] (is-header m [:cljs-land-tag [:header-tag "{" - [:keyword-tag ":k1"] + ["annotation" + {"path" #js [k1]} + [:keyword-tag ":k1"]] :spacer ["annotation" - {"path" #js [":k1"]} + {"path" #js [k1]} "{" ["annotation" - {"path" #js [":k1"]} + {"path" #js [k1 k2]} [:keyword-tag ":k2"]] :spacer ["annotation" - {"path" #js [":k1" ":k2"]} + {"path" #js [k1 k2]} [:string-tag "\"val\""]] "}"] "}"]])) @@ -1134,8 +1138,10 @@ [:cljs-land-tag [:header-tag "{" - "{" - "}" + ["annotation" + {"path" #js ["?"]} + "{" + "}"] :spacer ["annotation" {"path" #js ["?"]}