File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,10 @@ Changes can be:
40
40
41
41
* 💫 Cache expressions that return ` nil ` in memory
42
42
43
+ * 🐜 Turn off analyzer pass for validation of ` :type ` tags, fixes [ #488 ] ( https://github.com/nextjournal/clerk/issues/488 ) @craig-latacora
44
+
45
+ * 🐜 Strip ` :type ` metadata from forms before printing them to hash, fixes [ #489 ] ( https://github.com/nextjournal/clerk/issues/489 ) @craig-latacora
46
+
43
47
* 🐜 Ensure custom ` print-method ` supporting unreadable symbols preserves metadata
44
48
45
49
## 0.13.842 (2023-03-07)
Original file line number Diff line number Diff line change 549
549
#_(dep/immediate-dependencies (:graph (build-graph " src/nextjournal/clerk/analyzer.clj" )) #'nextjournal.clerk.analyzer/long-thing)
550
550
#_(dep/transitive-dependencies (:graph (build-graph " src/nextjournal/clerk/analyzer.clj" )) #'nextjournal.clerk.analyzer/long-thing)
551
551
552
- (defn strip-form-meta [form]
553
- (clojure.walk/postwalk
554
- (fn [v]
555
- (if (or (instance? clojure.lang.IObj v)
556
- (instance? clojure.lang.IMeta v))
557
- (vary-meta v (constantly nil ))
558
- v))
559
- form))
552
+ (defn ^:private remove-type-meta
553
+ " Walks given `form` removing `:type` from metadata to ensure it can be printed."
554
+ [form]
555
+ (walk/postwalk (fn [x] (cond-> x
556
+ (contains? (meta x) :type )
557
+ (vary-meta dissoc :type )))
558
+ form))
560
559
561
560
(defn hash-codeblock [->hash {:as codeblock :keys [hash form id deps vars]}]
562
561
(when (and (seq deps) (not (ifn? ->hash)))
563
562
(throw (ex-info " `->hash` must be `ifn?`" {:->hash ->hash :codeblock codeblock})))
564
563
(let [hashed-deps (into #{} (map ->hash) deps)]
565
564
(sha1-base58 (binding [*print-length* nil ]
566
- (pr-str (set/union (conj hashed-deps (if form (strip-form -meta form) hash))
565
+ (pr-str (set/union (conj hashed-deps (if form (remove-type -meta form) hash))
567
566
vars))))))
568
567
569
568
(defn hash
You can’t perform that action at this time.
0 commit comments