Fork me on GitHub
#cljs-dev
<
2019-09-23
>
martinklepsch15:09:32

If anything is unclear with what I’m trying to do above, let me know! 🙂

thheller15:09:29

although that should be done by default I think

thheller15:09:09

oh no wait .. you are using this incorrectly

martinklepsch15:09:06

yeah, that’s most likely correct 😄

thheller15:09:16

(defn- analyze-file [file]
  (let [opts  (-> {:foreign-libs [{:file "lib/fl.js"
                                   :provides ["react"]}]}
                  (cljs.closure/add-implicit-options))
        state (cljs.env/default-compiler-env opts)]
    (cljs.env/with-compiler-env state
      (ana/no-warn
        (cljs.closure/validate-opts opts)
        (ana/analyze-file file opts)))
    state))

thheller15:09:06

I think that should be right

thheller15:09:58

although you likely don't want to re-create the compiler env for every file you analyze

thheller16:09:27

I should shut up .. you probably have ana as cljs.analyzer.api in which case you code was correct

thheller16:09:37

I blindly assumed cljs.analyzer as ana

martinklepsch16:09:35

That still seems to fail to find the goog.obj namespace. Interestingly it doesn’t fail to find goog.object but goog.obj which is the alias used in one of the files being analyzed

thheller16:09:10

goog.obj is not part of the closure lib?

thheller16:09:05

you mean the file is using (:require [goog.object :as goog.obj])?

martinklepsch16:09:31

Oh my, it seems that the jar actually contains a namespace that requires goog.obj (i.e. has a typo)