shadow-cljs 2018-08-10

@statonjr has joined the channel

shadow-cljs test: is this just a placeholder for the future, or is it functional?

it'll be back eventually

Can someone point me to a canonical shadow-cljs.edn file (testing and everything included).

I know Leiningen has this, anything similar?

not really. I'm working on a template solution similar to lein templates

but what do you want to know? the docs should contain everything you need

if you still have questions please ask them so I can fill in the docs ๐Ÿ˜‰

I want to know what is wrong with my edn file

cli does not tell what is wrong

what error do you get?

shadow-cljs - error failed reading config file:

probably unbalanced parens

and paren balances the source oddly

Id expect test and app to be aligned

but it is offset by 1 char

then fix it?

I can take a look if you want to post it here or priv msg

which editor do you use?

I just need a simple example with valid syntax

with parinfer or paredit?

turned off now, crazy stuff

valid clojure is valid config syntax

:builds should be a map of :builds {:foo {...}}

just what I needed, thank you sir

but don't take that as a best practice or anything, its my development config with lots of test config builds

this will do!!

shadow-cljs init will create a basic config for you

there will be a shadow-cljs new ... soon

I just learned that I know nothing, so โ€ฆ.

Now I will know ๐Ÿ™‚

the "getting started" right now is pretty bad .. working on it

donโ€™t let perfect be the enemy of good

the professionals can figure out the details, get the basic structure correct and be aware of cognitive overload

(the current version suffers the latter, big time)

still curious to see your broken config though

just so I have something to test with and improve the error msg

I understand that, but not right now

the problem was: unbalanced parens, or more specific: skewed parens

since Iโ€™m fault free all the time, I blame it on parinfer

your โ€œcanonicalโ€ .edn file just ensured I was not crazy

Can I trust 9.2. Testing in the Browser chapter to be true?

yes (could be a lot cleaner though)

could be cleaner, but take care, love what you do!!

@thheller you mentioned the running nodejs remote fix might be in the next release, just wondering how far that might be?

and should i just check the npm page for updates? or are releases announced elsewhere?

I'm working on rather big branch right now that I don't want to leave

hope to get that done soon though. hopefully today.

much obliged simple_smile

I have an app in cljs which compiled within a few dozens of seconds, which is fine. However, now, it takes a very long time, if it ever succeeds. Even after reverting my last changes, compilation seems to take forever. Is there a way to 'debug'/profile compilation? (cross-posted from #clojurescript)

@kurt-o-sys try shadow-cljs watch app --verbose

the extra warnings from closure you are seeing should be gone in the latest version btw (they didn't matter anyways)

oh, ok, will check.

Am I looking for anything particular in the verbose compilation?

anything suspiciously long I guess?

well... it just hangs right now, not sure where exactly:

-> Cache read: ui_app/panels/booking_detail/location.cljs
<- Cache read: ui_app/panels/booking_detail/contact_details.cljs (56 ms)
-> Cache read: ui_app/panels/booking_detail/contact_detail.cljs
<- Cache read: ui_app/panels/booking_detail/location.cljs (19 ms)
<- Cache read: ui_app/panels/booking_detail/contact_detail.cljs (47 ms)

last 5 lines, nothing new apears.

-> means it started doing something, <- means it finished that something with x time

so I guess look for the last -> line that doesn't have a <-

hard to make that output cleaner with text only

-> Cache read: cljs/core/match.cljs

hmm it might be gigantic

there was a caching bug where the files would get larger with each compile

and I found another one.

but I think that was fixed in 2.4.28 already

there may be a few.

ok... let me check.

check .shadow-cljs/builds/app/dev/ana/cljs/core/match*

how large is it?

yeah the cache bug was fixed in 2.4.20

ok its not that then

its using a threadpool, so its probably just stuck behind some other tasks

check if you find another ->?

yeah, one of my ns, small one.

might be an infinite macro expansion?

is the CPU at 100%?

it is. 4.9GB memory, CPU 100%

I haven't got any macro's myself, so it would be another one...

kinda hard to debug since you are using lein

well wouldn't be much easier without but I could rule out classpath issues ๐Ÿ˜›

so, if I add the dependencies to shadow-cljs, it would be easier?

try to find the very first incomplete -> though

hi, Iโ€™m using a npm library and babel is returning a TypeError: Uncaught TypeError: Cannot instantiate an arrow function. Anyone can help me?

everything depending on that will be stuck behind that

@thheller nice - that will keep me busy for a while ๐Ÿ˜›

@kurt-o-sys you can send me the full log to <mailto:th.heller@gmail.com|th.heller@gmail.com>. I can take a look if you want

lein deps tree would help too, or the project.clj. no need to switch everything.

oh, I will try myself first ๐Ÿ˜›

@kurt-o-sys its very unlikely to be a dependency conflict though. I don't think any dep conflict causes an infinite loop during complation

not sure what it could be though. I've only seen such problems with infinitely expanding macros

is only the CPU busy or disk too?

hmm disk should be idle. cache is done async after compilation is done.

@guilherme.teodoro what do you mean by "babel is returning". that looks like a thrown exception in the browser? also the full error would help.

ah thx. got the email.

@thheller I seem to be getting there. Probably something with a package called graphql-builder and queries or syntax or so. At least, I can compile again if I remove some graphql-queries ๐Ÿ˜›. Thx!

ah yeah that parses graphql at compile time right?

@guilherme.teodoro that @absinthe/socket package is probably the weirdest code I have ever seen. no idea whats happening though.

@thheller yes, graphql parses plain queries at compile time. The problem seems to be: I defined a query with the same name twice.

@thheller hahaha thatโ€™s true.

.bind(void 0)
      , getHandlerName = function(e) {
        return _newArrowCheck(this, _this$4),
        "on" + String(e)
    }
    .bind(void 0)
      , notify = function(e, n, i) {
        return _newArrowCheck(this, _this$4),
        e.observers.forEach(getNotifier(getHandlerName(n), i))
    }
    .bind(void 0)
      , _this$6 = void 0
      , findIndex = function(e, n, i) {
        return _newArrowCheck(this, _this$6),
        e.findIndex(utilsComposite.hasIn([n], i))
    }
    .bind(void 0)
      , _this$5 = void 0
      , remove$1 = function(e) {
        return _newArrowCheck(this, _this$5),
        function(n) {
            return _newArrowCheck(this, _this$5),
            utilsArray.remove(findIndex(n, "request", e.request), 1, n)
        }
        .bind(this)
    }

what even is this? I thought I knew JS. guess I don't

Error:

Uncaught TypeError: Cannot instantiate an arrow function
    at exports.default (newArrowCheck.js:8)
    at index.js:2
    at Object.kitasato$events$create_absinthe_socket [as create_absinthe_socket] (events.cljs:250)
    at events.cljs:260
    at events.cljs:260
this method:
["@absinthe/socket" :as absinthe]
;; ....
line 250: (.create absinthe phoenix-socket)

@guilherme.teodoro yes I reproduced the error. can't figure out what is happening though. the JS is just weird.

JS made by Elixir developers

nah its seems flow generates that kind of code for arrow functions

I'm lost. can you confirm that this actually works fine in a webpack or so build? I don't see anything shadow-cljs could be doing differently

So, I donโ€™t if works in webpack

that also doesn't work for me?

you can just require ["@absinthe/socket/compat/umd/index" :as absinthe] to use that directly

hmmm, Iโ€™m gonna try

but the cljsjs package worked?

When I was using lein, yes

Can I use cljsjs package with shadow-cljs?

just ["@absinthe/socket" :as absinthe] and calling (absinthe/create nil) is enough to trigger the problem though

not sure whats happening but at least its reproducible

itโ€™s so weirdโ€ฆ

yeah I give up. can't figure it out.

https://github.com/thheller/shadow-cljs/issues/365 I'll see if I can figure out when I'm less tired.