Fork me on GitHub
#clojurescript
<
2019-01-13
>
thosmos00:01:27

@lxsameer it might be more than you need, but have you checked out Pathom, in particular its Connect feature? It's pretty powerful and can enable mixing multiple different types of endpoints (gql, rest, eql, etc) into one graph query.

lxsameer11:01:59

@thosmos thanks friend, will take a look

souenzzo13:01:09

@thosmos you can import graphql endpoints in pathom. @lxsameer I have a work in progress http driver for nodejs Checkout the "GitHub example"

ghadi20:01:40

Hi, I’m using bare cljs.main to launch a browser connected REPL like so: clj -A:redacted -m cljs.main -ro '@repl.edn' -r where repl.edn contains:

{:main rebl.REDACTED
 :preloads [rebl.browser]

 :output-to "resources/cognitect/rebl/REDACTED.js"
 :output-dir "resources/cognitect/rebl/cljsout"
 :asset-path "/resources/cognitect/rebl/cljsout"

 :port 9001
 :launch-browser false
 :verbose true

 :optimizations :none
 :cache-analysis true
 :source-map true}
The REPL connects, and when I evaluate (require 'rebl.redacted :reload) the browser appears to not be finding the fresh code that is stuffed in /var/folders/fh/s562tx1n41j4wyrsvlgydstm0000gn/T/out22959009146958254101213973269317956/myproject Have I done something wrong?

dnolen20:01:58

@ghadi hrm, I have run into cases where the temp-dir stuff doesn't seem to work - you can always specify a specific out dir

ghadi21:01:13

that isn't what I've done?

ghadi21:01:33

Oh, temp dir...

dnolen21:01:45

if you don't specify :output-dir then you get a OS specific temp dir via cljs.main

dnolen21:01:06

supply explicit -d

ghadi21:01:09

But I did specify output-dir...

ghadi21:01:36

In the repl opts, no?

dnolen21:01:42

ah you're probably not familiar with the options split

dnolen21:01:53

-co is compiler options

dnolen21:01:04

-ro is only repl options

dnolen21:01:10

assume they don't overlap

ghadi21:01:44

Ah ok. Since they do seem to overlap can I respecify -co to the same file?

dnolen21:01:55

like I said

dnolen21:01:58

assume they don't overlap

dnolen21:01:02

and all of your confusion will just go away

dnolen21:01:39

if I recall they don't really actually overlap

ghadi21:01:42

I guess I misunderstand: am I configuring two different things or two different phases of the same thing

dnolen21:01:52

it may seem like some options are the same but they really are not

dnolen21:01:04

you configuring two different things

dnolen21:01:11

one reason for this confusion is that the browser REPL takes compiler options

dnolen21:01:20

but this is for the thing that lives in the iframe

dnolen21:01:24

not your stuff

ghadi21:01:36

So to fix my config so that the initial browser repl connection works && reloading works...

ghadi21:01:24

I promise to make a diagram of this and submit it to clojurescript-site once I figure it out

dnolen21:01:40

actually let me refresh my memory, I'm probably remembering this wrong

dnolen21:01:36

-ro is completely about configuring the REPL env - the JS runner bit

dnolen21:01:13

so everything except :port and :launch-broswer in the above does not belong

ghadi21:01:42

Ok so move all the other stuff to -co

ghadi21:01:19

So can you rearticulate what was busted above?

dnolen21:01:29

what I just said

ghadi21:01:34

Stuff was getting reloaded but into an iframe?

dnolen21:01:34

all your compiler options were ignored

dnolen21:01:53

I don't know why it couldn't find the temp-dir

dnolen21:01:00

are you running this from Emacs, Cursive?

ghadi21:01:11

No from the shell

ghadi21:01:41

I'm trying to get this set up with only cljs.main

dnolen21:01:55

hrm, then yeah don't know - might be bug if you supply some of these unexpected options

ghadi21:01:09

Ok I'll split and retry. Thanks

ghadi21:01:33

@dnolen one last question: what is "the thing that lives in the iframe" responsible for doing?

dnolen21:01:09

it's how the browser REPL works

dnolen21:01:17

Google Closure CrossPage channel

dnolen21:01:37

you need a thing in the frame to do the communication bits

dnolen21:01:53

alternative is WebSockets of course

dnolen21:01:10

but the browser REPL goes back to 2011 when that wasn't so common

dnolen21:01:42

we haven't moved away from it as after some optimization work a little while ago it turned out that CrossPage Channel actually works quite well

ghadi22:01:00

Update: using the split suggested above:

Ghadis-MacBook-Pro:rebl ghadi$ cat cljs/compile.edn
{:main rebl.REDACTED
 :preloads [rebl.browser]
 :output-to "resources/cognitect/rebl/reblcljs.js"
 :output-dir "resources/cognitect/rebl/cljsout"
 :asset-path "/resources/cognitect/rebl/cljsout"
 :verbose true
 :optimizations :none
 :cache-analysis true
 :source-map true}
Ghadis-MacBook-Pro:rebl ghadi$ cat cljs/repl.edn
{:port 9001
 :launch-browser false
 :verbose true}
Currently hitting:
InternalError: too much recursion
when invoking like so:

ghadi22:01:37

clj -A:REDACTED -m cljs.main -co '@compile.edn' -ro '@repl.edn' -c -r

ghadi22:01:20

and then connecting from the browser