Skip to content

Commit

Permalink
Try a fix for cljs.analyzer dependency not working
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhinavOmprakash committed May 6, 2024
1 parent ca90a1d commit ee39e09
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject org.clojars.abhinav/snitch "0.1.15"
(defproject org.clojars.abhinav/snitch "0.1.16-SNAPSHOT"
:description
"Snitch injects inline defs in your functions and multimethods.
This enables a repl-based, editor-agnostic, clojure and clojurescript debugging workflow.
Expand Down
13 changes: 10 additions & 3 deletions src/snitch/mock_analyzer.clj → src/snitch/analyzer.cljc
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
(ns snitch.mock-analyzer
(ns snitch.analyzer
"Mocking the clojurescript.analyzer ns.
Required if you want to exclude cljs deps for a clj only project
"
(:refer-clojure :exclude [macroexpand-1]))


(try
(require '[cljs.analyzer :as ana])
(catch Exception _))


(defn macroexpand-1
[_env form]
form)
[env form]
(if (resolve 'ana)
(eval '(ana/macroexpand-1 env form))
form))
11 changes: 2 additions & 9 deletions src/snitch/core.cljc
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
(ns snitch.core
(:refer-clojure :exclude [#?(:cljs macroexpand)])
(:require
[clojure.string :as s])
[clojure.string :as s]
[snitch.analyzer :as ana])
#?(:cljs
(:require-macros
[snitch.core])))


;; cljs deps can be excluded in a clojure only
;; project so the deps won't be available
(try
(require '[cljs.analyzer :as ana])
(catch Exception _
(require '[snitch.mock-analyzer :as ana])))


(defn walk
"Like `clojure.walk/walk`, but preserves metadata."
[inner outer form]
Expand Down

0 comments on commit ee39e09

Please sign in to comment.