cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
martinklepsch 2019-09-23T15:31:32.035600Z

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

thheller 2019-09-23T15:49:10.036100Z

@martinklepsch you likely need to add this call so the goog deps are added to your compiler env https://github.com/clojure/clojurescript/blob/f021e99f2fab0069967ed134eecdf4be3b05958c/src/main/clojure/cljs/closure.clj#L2963

thheller 2019-09-23T15:52:29.036600Z

although that should be done by default I think

thheller 2019-09-23T15:53:09.036900Z

oh no wait .. you are using this incorrectly

martinklepsch 2019-09-23T15:54:06.037500Z

yeah, that’s most likely correct 😄

thheller 2019-09-23T15:54:16.037700Z

(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))

thheller 2019-09-23T15:56:06.038100Z

I think that should be right

thheller 2019-09-23T15:56:58.038600Z

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

thheller 2019-09-23T16:02:27.039700Z

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

thheller 2019-09-23T16:02:37.040Z

I blindly assumed cljs.analyzer as ana

martinklepsch 2019-09-23T16:03:35.040600Z

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

martinklepsch 2019-09-23T16:03:50.041Z

There’s a tiny bit more context here: https://github.com/lread/cljdoc-analyzer/pull/6

thheller 2019-09-23T16:04:10.041400Z

goog.obj is not part of the closure lib?

thheller 2019-09-23T16:06:05.041800Z

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

martinklepsch 2019-09-23T16:13:31.042300Z

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