cljs.js/analyze-deps
function | removed v1.7.28 | added v1.7.10 | Edit |
(analyze-deps bound-vars ana-env lib deps cb)
(analyze-deps bound-vars ana-env lib deps opts cb)
(defn analyze-deps
([bound-vars ana-env lib deps cb]
(analyze-deps bound-vars ana-env lib deps nil cb))
([bound-vars ana-env lib deps opts cb]
(let [compiler @(:*compiler* bound-vars)]
(binding [ana/*cljs-dep-set* (vary-meta (conj (:*cljs-dep-set* bound-vars) lib)
update-in [:dep-path] conj lib)]
(assert (every? #(not (contains? (:*cljs-dep-set* bound-vars) %)) deps)
(str "Circular dependency detected "
(-> (:*cljs-dep-set* bound-vars) meta :dep-path)))
(if (seq deps)
(let [dep (first deps)]
(try
((:*load-fn* bound-vars) {:name dep :path (ns->relpath dep)}
(fn [resource]
(assert (or (map? resource) (nil? resource))
"*load-fn* may only return a map or nil")
(if resource
(let [{:keys [name lang source]} resource]
(condp = lang
:clj (analyze* bound-vars source name opts
(fn [res]
(if-not (:error res)
(analyze-deps bound-vars ana-env lib (next deps) opts cb)
(cb res))))
:js (analyze-deps bound-vars ana-env lib (next deps) opts cb)
(wrap-error
(ana/error ana-env
(str "Invalid :lang specified " lang ", only :clj or :js allowed")))))
(cb (wrap-error
(ana/error ana-env
(ana/error-message :undeclared-ns
{:ns-sym dep :js-provide (name dep)})))))))
(catch :default cause
(cb (wrap-error
(ana/error ana-env
(str "Could not analyze dep " dep) cause))))))
(cb {:value nil}))))))