(analyze-deps lib deps env)
(analyze-deps lib deps env opts)
Given a lib, a namespace, deps, its dependencies, env, an analysis environment
and opts, compiler options - analyze all of the dependencies. Required to
correctly analyze usage of other namespaces.
Source
(defn analyze-deps
"Given a lib, a namespace, deps, its dependencies, env, an analysis environment
and opts, compiler options - analyze all of the dependencies. Required to
correctly analyze usage of other namespaces."
([lib deps env]
(analyze-deps lib deps env
(when env/*compiler*
(:options @env/*compiler*))))
([lib deps env opts]
(let [compiler @env/*compiler*]
(binding [*cljs-dep-set* (vary-meta (conj *cljs-dep-set* lib) update-in [:dep-path] conj lib)]
(assert (every? #(not (contains? *cljs-dep-set* %)) deps)
(str "Circular dependency detected, "
(apply str
(interpose " -> "
(conj (-> *cljs-dep-set* meta :dep-path)
(some *cljs-dep-set* deps))))))
(doseq [dep deps]
(when-not (or (not-empty (get-in compiler [::namespaces dep :defs]))
(contains? (:js-dependency-index compiler) (name dep))
(node-module-dep? dep)
(js-module-exists? (name dep))
#?(:clj (deps/find-classpath-lib dep)))
#?(:clj (if-some [src (locate-src dep)]
(analyze-file src opts)
(throw
(error env
(error-message :undeclared-ns {:ns-sym dep :js-provide (name dep)}))))
:cljs (throw
(error env
(error-message :undeclared-ns {:ns-sym dep :js-provide (name dep)}))))))))))