Fork me on GitHub
#clojurescript
<
2017-07-26
>
kauko05:07:38

We updated our ClojureScript dependency to "1.9.660" and clojure-future-spec to "1.9.0-alpha17" a few weeks ago. Since then sometimes when we compile our cljs, the compilation fails with the message Attempting to call unbound fn: #'clojure.spec.alpha/macroexpand-check. This doesn't happen always, and seems to point to different places in our codebase. It's not the same line, and I don't think it's the same namespace (or a set of namespaces). Has anyone had problems like this?

kauko05:07:17

After trying again a few times the compilation passes, and everything seems to work fine

dnolen05:07:45

Known issue with parallel build. You should try master

kauko05:07:56

Thanks for the quick response. 🙂 We'll either turn off the parallel build, or like you said, try the master version.

giovaferra10:07:43

Hi every one! I'm trying to make tests with cljsbuild. I would like to have the auto-run of tests when I change a file, a command like "lein cljsbuild auto test" , but I can't find any example of it. I'm missing something? :thinking_face:

kauko10:07:15

hmm, not sure if you can automatically run tests with cljsbuild.. we use doo https://github.com/bensu/doo

giovaferra10:07:54

Oh yes, I have seen that library and it seems to do exactly what I want. Unfortunatly my target is nodejs version 0.10.x (with newer version I get an "illegal instruction" from the processor where I run my program) while that library is for newer version (0.12), should I use it anyway? :thinking_face:

mkvlr10:07:19

any recommendations for streaming a chunked http response? is there a library I should use or use js/fetch directly?

mkvlr11:07:31

ah I see it’s possible with xmlhttprequest as well…

joshkh11:07:26

when compiling my minified cljs using lein cljsbuild once min i'm getting the following error:

Compiling "resources/public/js/compiled/app.js" failed.
clojure.lang.ExceptionInfo: failed compiling file:resources/public/js/min/test/cljs/core.cljc {:file #object[java.io.File 0x43f9c193 "resources/public/js/min/test/cljs/core.cljc"]}
	at clojure.core$ex_info.invokeStatic(core.clj:472
...
Caused by: clojure.lang.ExceptionInfo: Assert failed: Circular dependency detected, cljs.core -> cljs.core
(every? (fn* [p1__2581#] (not (contains? *cljs-dep-set* p1__2581#))) deps) in file resources/public/js/min/test/cljs/core.cljc {:tag :cljs/analysis-error}
	at clojure.core$ex_info.invokeStatic(core.clj:4725)
	at clojure.core$ex_info.invoke(core.clj:4725)
	at cljs.analyzer$error.invokeStatic(analyzer.cljc:657)
...

Any thoughts? Here's my project.clj https://github.com/joshkh/bluegenes/blob/mymine/project.clj

joshkh11:07:32

The dev build works just fine, lein cljsbuild once dev

mkvlr12:07:57

@danielblack sorry I wasn’t clear, I’m looking for something on the client side, I’m using https://github.com/Day8/re-frame-http-fx

mkvlr12:07:46

but looks like this and cljs-ajax which it uses under the hood doesn’t support it https://github.com/JulianBirch/cljs-ajax/issues/76

joshkh12:07:16

how about cljs-http ?

joshkh12:07:37

what happens if you chuck a 206 partial content header in the request?

danielstockton12:07:15

Is there a way to work on a library locally and depend on it with another library, without always lein install in one and restart repl in the other?

mkvlr12:07:56

@joshkh will give that a try, thanks!

joshkh12:07:37

@mkvlr i prefer cljs-http over cljs-ajax because sometimes i want to cancel a request, so i create the request and store the resulting channel in app-db, and then use an effect to handle the response

(reg-fx
  :mkvlr/http
  (fn [{:keys [on-success on-unauthorized chan]}]
    (go
      (let [{:keys [statusCode] :as response} (<! chan)]
        (if (and statusCode (= statusCode 401))
          (dispatch (conj on-authorized response))
          (dispatch (conj on-success response)))))))

mkvlr12:07:36

looks simple enough, thanks

joshkh12:07:16

just solving my own problem above, my cljsbuild min profile had an :output-dir that matched the compiled test js folder. must have been a relic from copying and pasting!

deadghost16:07:05

can I get the result of :first-dispatch?

deadghost16:07:31

so I can feed it into handlers in my rules?

tiagoantao21:07:32

I am finding a difference (actually, quite a few) between cljs.js on the standard clojurescript and lumo. Namely: cljs standard does not define *eval-fn* and *load-fn* (meaning that {:eval cljs/js-eval} needs to be passed as opt to eval or it will fail. Also the empty-state of the standard includes cljs.core which is quite big. Lumo has defaults for *eval/load-fn* functions and 'empty-state` is... empty 😉

jpmonettas21:07:02

Hi everybody, I'm trying specs on cljs but can't instrument because "clojure.lang.ExceptionInfo: No such namespace: clojure.test.check"

jpmonettas21:07:12

Am i missing something?

anmonteiro22:07:20

@tiagoantao the purpose of cljs.js is to be reusable on every environment

anmonteiro22:07:46

if you’re targeting the browser your load-fn is gonna be different than if you’re targeting Node

anmonteiro22:07:53

or JavaScriptCore, like Planck

anmonteiro22:07:21

@tiagoantao as for the empty-state thing, you can pass the :dump-core false option to your compiler options

tiagoantao22:07:37

@anmonteiro At the end of the day I think the problem is lack of documentation on the subject. I am taking some notes in order to write something about this in the near future, but my level of maturity is still quite low...

anmonteiro22:07:24

there are docstrings in the cljs.js functions, and Mike Fikes’s blog is a pretty good source of info: http://blog.fikesfarm.com

anmonteiro22:07:59

@tiagoantao but self-host support should be considered an advanced feature

mfikes23:07:48

@tiagoantao It is perhaps not at the level you may need, but if it helps, I gave a talk on self-hosted ClojureScript: https://youtu.be/HnQ89r_dKEM