Fork me on GitHub
#lumo
<
2017-06-01
>
Yehonathan Sharvit03:06:31

@anmonteiro Let me explain what I mean by “skip requiring a ns”. I am using lumo to generate the analysis cache of some namespaces. For instance, for generating the analysis cache for reagent, I am running:

lumo -k /path/to/cache
and inside lumo: (require 'reagent) reagent requires ‘cljsjs.react and currently in lumo 1.5 it doesn’t work I was thinking about skipping cljsjs.react as it is not really needed for the analysis cache

anmonteiro03:06:05

what you’re saying doesn’t make a lot of sense

anmonteiro03:06:16

simply because you might get corrupted analysis cache

anmonteiro03:06:32

that said, you can probably doing it by messing with the internals of the CLJS compiler

anmonteiro03:06:25

@viebel specifically, by doing something like (swap! cljs.js/*loaded* conj 'cljsjs.react)

anmonteiro03:06:01

I just did it here and it skipped

anmonteiro03:06:26

I don’t even have cljsjs.react in my classpath and require succeeded

anmonteiro03:06:43

however, note that you’re on your own once again 🙂

Yehonathan Sharvit03:06:08

Thanks @anmonteiro. I see how in the general case, marking a ns as already loaded might corrupt the analysis cache. Do you think that in the case of a cljsjs lib it could also happen?

anmonteiro03:06:36

JavaScript foreign libraries don’t add anything to the analysis cache, so no

Yehonathan Sharvit03:06:26

Another question: I’m trying to (require 'day8.re-frame.http-fx) and it fails on XMLHttpRequest is not defined that comes down to this line: https://github.com/JulianBirch/cljs-ajax/blob/master/src/ajax/xml_http_request.cljs#L12-L17

Yehonathan Sharvit03:06:59

but when I am executing

(def xmlhttprequest
  (if (= cljs.core/*target* "nodejs")
    (let [xmlhttprequest (.-XMLHttpRequest (js/require "<@U071MQNLR>/xmlhttprequest"))]
      (goog.object/set js/global "XMLHttpRequest" xmlhttprequest)
      xmlhttprequest)
    (.-XMLHttpRequest js/window)))
I am getting another error Cannot find module '<@U071MQNLR>/xmlhttprequest'

Yehonathan Sharvit03:06:33

inside lumo, cljs.core/*target* is “nodejs” right?

Yehonathan Sharvit03:06:50

Is it the same also during the analysis phase?

anmonteiro03:06:26

@viebel sure, did you npm install <@U071MQNLR>/xmlhttprequest?

Yehonathan Sharvit03:06:53

Is there a way to install an npm package from the project.clj?

anmonteiro03:06:20

that’s not really a Lumo question

anmonteiro03:06:24

I don’t use Lein

Yehonathan Sharvit04:06:31

Another question @anmonteiro : is clojure.edn available in self-host env?

anmonteiro04:06:56

no, but there’s cljs.tools.reader

Yehonathan Sharvit04:06:10

Oh yeah. I forgot about it