Hi there, I see that the shadow.css.build/collect-namespaces-for-chunk function also allows for a string :include configuration to be provided to shadow.css.build/generate.
I was trying to use the string :include configuration, but kept getting the error below.
class clojure.lang.Symbol cannot be cast to class java.lang.CharSequence (clojure.lang.Symbol is in unnamed module of loader 'app'; java.lang.CharSequence is in module java.base of loader 'bootstrap')
It seems that the error occurs because a regular expression comparison is being used directly on the namespace symbol.
I have included a suggested fix below to use the name string of the namespace symbol instead for this comparison - for your kind consideration.
Many thanks for this wonderful library!
(defn collect-namespaces-for-chunk
[{:keys [include entries] :as chunk} {:keys [namespaces] :as build-state}]
(let [namespace-matchers
(->> include
(map (fn [x]
(cond
(string? x)
(let [re (re-pattern x)]
#(re-find re (name %))) ;; <-- use `name` string of symbol instead
(not (symbol? x))
(throw (ex-info "invalid include pattern" {:x x}))
:else
(let [s (str x)]
;; FIXME: allow more patterns that can be expressed as string?
;; foo.bar.*.views?
(if (str/ends-with? s "*")
;; foo.bar.* - prefix match
(let [prefix (subs s 0 (-> s count dec))]
(fn [ns]
(str/starts-with? (str ns) prefix)))
;; exact match
(fn [ns]
(= x ns)))))))
(into []))
Hi there, I see that the
shadow.css.build/collect-namespaces-for-chunk
function also allows for a string:include
configuration to be provided toshadow.css.build/generate
.I was trying to use the string
:include
configuration, but kept getting the error below.It seems that the error occurs because a regular expression comparison is being used directly on the namespace symbol.
I have included a suggested fix below to use the
name
string of the namespace symbol instead for this comparison - for your kind consideration.Many thanks for this wonderful library!