Fork me on GitHub
#shadow-cljs
<
2018-08-10
>
chrisps11:08:09

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

thheller11:08:21

it'll be back eventually

chrisps12:08:03

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

chrisps12:08:43

I know Leiningen has this, anything similar?

thheller12:08:06

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

thheller12:08:27

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

thheller12:08:44

if you still have questions please ask them so I can fill in the docs 😉

chrisps12:08:46

I want to know what is wrong with my edn file

chrisps12:08:00

cli does not tell what is wrong

thheller12:08:05

what error do you get?

chrisps12:08:15

shadow-cljs - error failed reading config file:

thheller12:08:24

probably unbalanced parens

chrisps12:08:04

and paren balances the source oddly

chrisps12:08:17

Id expect test and app to be aligned

chrisps12:08:27

but it is offset by 1 char

thheller12:08:46

then fix it?

thheller12:08:17

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

thheller12:08:57

which editor do you use?

chrisps12:08:24

I just need a simple example with valid syntax

thheller12:08:29

with parinfer or paredit?

chrisps12:08:39

turned off now, crazy stuff

thheller12:08:47

valid clojure is valid config syntax

thheller12:08:07

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

chrisps12:08:27

yes please

chrisps12:08:40

just what I needed, thank you sir

thheller12:08:44

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

chrisps12:08:55

this will do!!

thheller12:08:17

shadow-cljs init will create a basic config for you

thheller12:08:30

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

chrisps12:08:38

I just learned that I know nothing, so ….

chrisps12:08:50

Now I will know 🙂

thheller12:08:59

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

chrisps12:08:50

don’t let perfect be the enemy of good

chrisps12:08:05

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

chrisps12:08:17

(the current version suffers the latter, big time)

thheller12:08:39

still curious to see your broken config though

thheller12:08:56

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

chrisps12:08:17

I understand that, but not right now

chrisps12:08:12

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

chrisps12:08:48

since I’m fault free all the time, I blame it on parinfer

chrisps12:08:58

(not really)

chrisps12:08:31

your “canonical” .edn file just ensured I was not crazy

chrisps12:08:41

(just sloppy)

chrisps13:08:26

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

thheller13:08:17

yes (could be a lot cleaner though)

chrisps13:08:08

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

currentoor18:08:23

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

currentoor18:08:48

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

thheller18:08:10

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

thheller18:08:35

hope to get that done soon though. hopefully today.

currentoor18:08:52

much obliged simple_smile

kurt-o-sys19:08:15

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)

thheller19:08:26

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

thheller19:08:00

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

kurt-o-sys19:08:58

oh, ok, will check.

kurt-o-sys19:08:22

Am I looking for anything particular in the verbose compilation?

thheller19:08:00

anything suspiciously long I guess?

kurt-o-sys19:08:31

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)

kurt-o-sys19:08:44

last 5 lines, nothing new apears.

thheller19:08:50

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

thheller19:08:09

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

thheller19:08:40

hard to make that output cleaner with text only

kurt-o-sys19:08:01

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

kurt-o-sys19:08:40

doesn't finish

thheller19:08:34

hmm it might be gigantic

thheller19:08:57

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

kurt-o-sys19:08:26

and I found another one.

thheller19:08:27

but I think that was fixed in 2.4.28 already

kurt-o-sys19:08:29

there may be a few.

kurt-o-sys19:08:33

ok... let me check.

thheller19:08:49

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

thheller19:08:52

how large is it?

thheller19:08:15

yeah the cache bug was fixed in 2.4.20

kurt-o-sys19:08:10

oh, small... 6.4k

thheller19:08:29

ok its not that then

thheller19:08:42

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

thheller19:08:51

check if you find another ->?

kurt-o-sys19:08:18

yeah, one of my ns, small one.

kurt-o-sys19:08:21

will try again

thheller19:08:40

might be an infinite macro expansion?

thheller19:08:09

is the CPU at 100%?

kurt-o-sys19:08:25

it is. 4.9GB memory, CPU 100%

kurt-o-sys19:08:42

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

thheller19:08:45

kinda hard to debug since you are using lein

thheller19:08:10

well wouldn't be much easier without but I could rule out classpath issues 😛

kurt-o-sys19:08:11

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

kurt-o-sys19:08:19

lol, ok 🙂

thheller19:08:53

try to find the very first incomplete -> though

guilherme.teodoro19:08:00

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

thheller19:08:07

everything depending on that will be stuck behind that

kurt-o-sys19:08:02

@thheller nice - that will keep me busy for a while 😛

thheller19:08:50

@kurt-o-sys you can send me the full log to <mailto:[email protected]|[email protected]>. I can take a look if you want

thheller19:08:36

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

kurt-o-sys19:08:26

oh, I will try myself first 😛

thheller19:08:06

@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

thheller19:08:49

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

thheller19:08:11

is only the CPU busy or disk too?

thheller19:08:51

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

thheller19:08:26

@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.

thheller20:08:01

ah thx. got the email.

kurt-o-sys20:08:03

@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!

thheller20:08:40

ah yeah that parses graphql at compile time right?

thheller20:08:42

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

kurt-o-sys20:08:46

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

thheller20:08:53

.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)
    }

thheller20:08:25

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

guilherme.teodoro20:08:48

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)

thheller20:08:56

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

guilherme.teodoro20:08:12

JS made by Elixir developers

thheller20:08:30

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

thheller20:08:38

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

guilherme.teodoro20:08:20

So, I don’t if works in webpack

thheller20:08:27

that also doesn't work for me?

thheller20:08:48

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

guilherme.teodoro20:08:55

hmmm, I’m gonna try

thheller20:08:18

but the cljsjs package worked?

guilherme.teodoro20:08:54

When I was using lein, yes

guilherme.teodoro20:08:20

Can I use cljsjs package with shadow-cljs?

thheller20:08:26

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

thheller20:08:44

not sure whats happening but at least its reproducible

guilherme.teodoro20:08:19

it’s so weird…

thheller21:08:09

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

thheller21:08:27

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