Fork me on GitHub
#clojurescript
<
2016-08-30
>
domgetter01:08:15

Anyone using re-natal on Linux with Figwheel? I cant' seem to get the app to connect to the Figwheel server

cdine04:08:38

Replumb doesn't seem to handle multiple forms at once... any ideas on how to tackle this? My initial thought is to somehow read forms and eval it one form at a time .. any thoughts?

cdine04:08:57

I guess I should find out how its done in planck here... https://github.com/mfikes/planck/issues/197

mfikes04:08:24

@cdine Since a lot of the Replumb code was derived from Planck and Planck has been updated to handle multiple forms at once, perhaps you could use it’s implementation as a guide or for inspiration. The relevant commit was probably this one https://github.com/mfikes/planck/commit/d2171b7a836ca605a936e36f636362ac415cf4dd

cdine04:08:35

Thanks @mfikes .. I'm checking it out..

mfikes04:08:41

@cdine There is also a patch in http://dev.clojure.org/jira/browse/CLJS-1572 that provides the same functionality for the regular ClojureScript REPL, in case it is of interest.

cdine04:08:26

Awesome, that's really helpful. Thanks a ton.

mfikes04:08:52

@cdine No problem. I’d like to see that in Replumb if you sort it 🙂

ag05:08:21

so clojure.spec.gen is not yet been ported to cljs, right?

ag05:08:20

nvmd… it’s in different namespace: cljs.spec.impl.gen

ag06:08:51

ehem.. I’m sure this question been asked many times. I found a few solutions, find them a bit bulky. so what’s the canonical way of generating uuid nowadays?

ag06:08:45

nvmd this one as well… found cljs.core/random-uuid

madvas10:08:38

is there something like leiningen :injections but for clojurescript?

madvas10:08:56

I just saw it, thanks!

chrisetheridge10:08:12

is it possible to debug optimizations when using lein-cljsbuild ?

chrisetheridge10:08:28

when using anything other then :optimizations :none on my build, it fails

chrisetheridge10:08:43

with no error, just:

chrisetheridge10:08:47

Applying optimizations :simple to 138 sources
Compiling "target/js/app.js" failed.
Subprocess failed

darwin10:08:13

@biscuitpants look into generated output folder, and skim those generated js sources, maybe you could spot some issue there

chrisetheridge10:08:18

will give that a shot, thank you @darwin

madvas10:08:17

@darwin can I somehow integrate :preloads into profiles.clj?

darwin10:08:59

yes, I believe - :preloads is a normal key (deep) inside :cljsbuild map, normal profile merging rules should apply

darwin10:08:33

what are you trying to do exactly?

chrisetheridge10:08:58

i’m gonna put my build config here, maybe i’m doing something wrong

chrisetheridge10:08:19

{:id           "prod"
     :source-paths ["src-cljs"]
     :assert false
     :compiler     {:optimizations  :simple
                    :pretty-print   false
                    :parallel-build true
                    :compiler-stats true
                    :elide-asserts  true
                    :output-to      "target/js/app.js"
                    :verbose        true
                    :warnings true }}

darwin10:08:29

@biscuitpants maybe try to integrate latest figwheel, it does pretty nice config valiadations, to me your snippet looks good

darwin10:08:46

I would also try to comment out all non-essential settings

madvas10:08:02

I just wanna run piece of code for every project before main file is run

chrisetheridge10:08:19

good idea @darwin, maybe that will give me a bit more info

darwin10:08:43

@madvas ok, then :preloads sounds like a good solution, but they work ONLY when compiling with :main

darwin10:08:35

I’m just curious how you can do this using profile merging from system-global profiles.clj, :cljsbuild uses different ids so you cannot easily target all of them via some “template” in profiles.clj

madvas10:08:28

nah, it doesn’t work, but I can just pass it into figwheel in REPL anyway, too bad I have to put there just namespace and not code, as in :injections

dnolen13:08:05

@biscuitpants seems strange to fail without error, might want to just try building with ClojureScript directly to see what’s up

chrisetheridge13:08:38

@dnolen yeah just doing a plain build it works completely fine. no errors, and i get a compiled js file (which just has goog dependencies)

chrisetheridge13:08:47

but, as soon as i put in an optimization, it fails

chrisetheridge13:08:01

been trying with the Google Closure jar, and that doesn’t work either. fails silently (even with all errors and warnings on)

dnolen13:08:27

we need to pull apart what you are trying - it’s sounds a bit confusing to me now

dnolen13:08:45

don’t use lein-cljsbuild, use the same compiler settings and build your project with the ClojureScript compiler directly

dnolen13:08:08

this will tell you if there’s a problem specific to lein-cljsbuild and hopefully give you an idea what it might be

chrisetheridge13:08:50

okay that’s a good idea. so using the ClojureScript compiler api

chrisetheridge13:08:54

i will give that a bash

dnolen13:08:09

just like how it’s covered in the Quick Start

chrisetheridge13:08:39

thank you @dnolen. i will let you know what comes from that 🙂

chrisetheridge13:08:43

so it can’t find cognitect.transit in one of my .cljc files

chrisetheridge13:08:59

but the dep for cognitect/transit-cljs is definitely there

mfikes13:08:04

@biscuitpants During build it is likely using transit-clj

chrisetheridge13:08:32

sorry, didn’t give an error msg:

chrisetheridge13:08:38

Caused by: clojure.lang.ExceptionInfo: No such namespace: cognitect.transit, could not locate cognitect/transit.cljs, cognitect/transit.cljc, or Closure namespace "cognitect.transit" in file src-cljs/cognician/hex/util.cljc {:tag :cljs/analysis-error}

mfikes13:08:38

Ahh, OK. Perhaps it is a matter of scrutinizing the classpath

chrisetheridge13:08:33

okay, so lein run -m clojure.main build.clj gets me passed that error, and compiles the js

chrisetheridge13:08:36

let me try with optimizations now

jannis13:08:27

Does ClojureScript do something special with specs refered to in :req when using cljs.spec/keys? Assume I have (s/def :user/name :some-string-spec) (s/def :user/bio :some-string-spec) (s/def :user (s/keys :req [:user/name] :opt [:user/bio])) and then do (s/get-spec :user/name) and (s/get-spec :user/bio), the former returns some spec object, while the latter returns :some-string-spec (the original keyword/spec name).

chrisetheridge14:08:12

yup @dnolen back to the failing silently part again

dnolen14:08:25

Paste your whole shell interaction please

chrisetheridge14:08:37

➔ lein run -m clojure.main build.clj

chrisetheridge14:08:40

where build.clj is:

chrisetheridge14:08:46

(require 'cljs.build.api)

(cljs.build.api/build "src-cljs"
  {:output-to "resources/public/js/main.js"
   :optimizations :advanced})

(System/exit 0)

dnolen14:08:24

Use the same setting please

dnolen14:08:45

And I want to see the entire terminal interaction pasted

dnolen14:08:22

No for your project

dnolen14:08:36

We have to stop changing variables here

dnolen14:08:48

No idea what's going on

chrisetheridge14:08:00

code/Cognician/Hex on customer-reporting [!?$] 
➔ lein run -m clojure.main build.clj
Compile sources, elapsed time: 7812.549492 msecs
Compile sources, elapsed time: 0.093968 msecs

code/Cognician/Hex on customer-reporting [!?$] 
➔ ls resources/public/js 
hex

code/Cognician/Hex on customer-reporting [!?$] 
➔ 

chrisetheridge14:08:27

ah wait i see a problem with my build.clj

chrisetheridge14:08:31

since i copied it from the project.clj

chrisetheridge14:08:22

okay, updated both build.clj and my shell interaction @dnolen

dnolen14:08:44

@biscuitpants I don’t see any errors in that terminal output

dnolen14:08:51

and you need to turn on :verbose

am-a_metail14:08:29

So we are including our script on a third-party site that has an AMD module loader (which we have no control over) - this is breaking anything we include that uses the UMD style (typeof window.define !== undefined). Specifically we are getting React is not defined. Now we solved this by wrapping the script and setting define to null. Is there a neater way to do this perhaps?

dnolen14:08:53

life in the JavaScript world

nickt14:08:46

I don't think there's a neater way to do it... you can't assume anything about the isolation of your script on third party sites

jannis14:08:16

Ok, my spec issues earlier are caused by defining the same spec, e.g. :user/name, in two different namespaces and then having one taking priority while expecting the other would be used.

am-a_metail15:08:56

@dnolen - one way which would have convenient at least would be allowing :output-wrapper to be a template string rather than true/false

am-a_metail15:08:12

Worth raising a bug/PR?

dnolen17:08:53

@am-a_metail no template strings, but I guess we could allow it to be a function which returns a string

dnolen17:08:11

low priority enhancement ticket for that is fine

lwhorton18:08:20

hmm… is there an advanced-compilation friendly way to use resolve in cljs?

lwhorton18:08:25

I’m trying to do something like ((resolve ‘my-other-ns.foo) args) where `my-other-ns isn’t known ahead of time

lwhorton18:08:14

except resolve isn’t supported in cljs, so I was thinking about some sort of hack with aget, which means I would have to explicitly ^:export anything ns needs referencing… which makes me think this is not the best way to go about it.

jr18:08:59

can you do it with a multimethod where ’my-other-ns.foo is a dispatch value?

lwhorton18:08:57

hmm, i dont know enough about multimethods to know what that means.. but ill take a look thanks @jr

dnolen19:08:31

@lwhorton doing any kind of run time resolution is swimming upstream

dnolen19:08:04

it’s intentionally ill supported because of advanced compilation

lwhorton19:08:43

it certainly feels like that.. bummer, but I’m sure i can come up with something. wanted to make sure this wasn’t a solved problem first. thanks!

richiardiandrea20:08:51

Hey folks..in order to get the Clojurescript docset bumped to the official Dash/Zeal server, we need ~40 emails to . The Clojurescript docset is maintained by @shaunlebron and especially nice because it contains a lot of examples (personally I use it instead of the Clojure one, in conjunction with zeal-at-point for emacs). We are a lot here, I guess we don't want to flood the thing, but please support: https://twitter.com/richiardiandrea/status/770713244197593089

shaunlebron20:08:13

thanks @richiardiandrea, I’m aiming to have the newest docset reflect the new site soon

shaunlebron20:08:50

might be easier to ask for support when the docset is actually up to date with latest version

shaunlebron20:08:27

so i’ll start helping to petition for that when that’s done

lwhorton21:08:28

does the cljs compiler support any sort of metadata tagging to ignore-warning for particular lines?

lwhorton21:08:51

would be great to get rid of “warning this is overriding clojure.core/foo” if we could do something like (defn ^:ignore-warn foo [])

darwin21:08:22

@lwhorton you are aware of (:refer-clojure :exclude …), right?