This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-31
Channels
- # announcements (5)
- # babashka (105)
- # beginners (92)
- # calva (77)
- # cider (17)
- # cljdoc (8)
- # cljs-dev (8)
- # cljsrn (8)
- # clojure (272)
- # clojure-dev (25)
- # clojure-europe (5)
- # clojure-italy (6)
- # clojure-nl (7)
- # clojure-norway (3)
- # clojure-uk (108)
- # clojurescript (326)
- # code-reviews (4)
- # cursive (6)
- # datomic (37)
- # duct (5)
- # emacs (14)
- # fulcro (23)
- # graphql (1)
- # juxt (1)
- # kaocha (2)
- # leiningen (10)
- # malli (9)
- # music (1)
- # nrepl (12)
- # pathom (21)
- # pedestal (2)
- # planck (4)
- # quil (3)
- # reitit (29)
- # rewrite-clj (10)
- # shadow-cljs (82)
- # spacemacs (29)
- # sql (6)
- # tools-deps (19)
that was from preloads, if I just require it in my root namespace, I get The required namespace "shadow.remote.runtime.browser" is not available, it was required by "xxxxx/main.cljs".
@mattly that is all still undergoing massive changes. the namespace was moved to shadow.remote.runtime.cljs.browser
@mattly also note the shadow-cljs - server version: 2.8.52
. so you are still an old version. need to update deps.edn
when using that
Huh, I didn’t realize shadow-cljs.server didn’t get updated along with the cli, it’s not in my does
I'm going to try and get it working over lunch, I just need to know how to swap from the Clojure context into the ClojureScript one from within the prepl socket.
you can't switch it in prepl. prepl doesn't allow that. thats why I added this? https://github.com/thheller/shadow-cljs/issues/508#issuecomment-535866881
Sure, sorry, I think I worded that really poorly. I was under the impression when you connect to that prepl it isn't a ClojureScript environment but that was 2nd hand information, I'll try it for myself.
Thank you for adding prepl support in the first place! I'll try to get Conjure + shadow-cljs prepl documented somewhere, I just have 0 / negative free time right now.
From what i understand they should be able to work out of the box, yet i get Error from :frontend java.io.IOException: Stream closed
Ah, interesting, let me have a go. If I get it working I'll add a link / guide here https://github.com/Olical/conjure/wiki
That just means the socket is kicking you off just after you connect which could be because node / your browser isn't running / ready to evaluate JavaScript on the behalf of shadow-cljs... I think...
I can change it so it doesn't kick you off but instead waits for a runtime? if that makes sense
Hmm that could be pretty neat :thinking_face: might help in scenarios where you refresh the browser or something? Would it be able to hook you up to the new environment?
If not, no worries. With Conjure you just hit one key combo and it'll reconnect whatever it can anyway.
> Ah I understand what you mean now, thanks for the explanation! I would argue you go for the first environment and maybe disconnect the prepl if there's nothing there, that way the client will know it's reconnecting to a new environment.
@U38J3881W with (`<localleader>cu` or :ConjureUp
) i get disconnected immediately
Yep, trying to repro and investigate now, I've been putting off investigating for a while.
Hmm, sorry to bother you @thheller, I'm just trying to netcat into a prepl I started, I'm using npx shadow-cljs node-repl
with what I think is some super basic config
{:builds
{:demo
{:target :node-script
:modules {:main {:init-fn conjure-demo.main/init}}}}
:prepl {:demo 36751}}
It starts up okay but I get the no runtimes error. If you think I'm just configuring / starting it wrong I'll go dig through docs now. If you think this looks okay then maaaaybe something is wrong?` [:app] Build completed. (405 files, 1 compiled, 0 warnings, 6.62s) 32 Exception in thread "Clojure Connection repl 1" clojure.lang.ExceptionInfo: failed compiling file:out/clojure/browser/event.cljs {:file #object[java.io.File 0x72769185 "out/clojure/browser/event.cljs"], :cloj 33 ure.error/phase :compilation} `
$ nc localhost 12345
(js/console.log "foo")
{:tag :ret :ns cljs.user :form "(js/console.log \"foo\")" :ms 1 :val nil}
It needs to be a string because you can't parse some things that came from another environment, such as records and reader conditionals. So you can pr-str
it in the eval environment but then you need to turn it into a string to make sure the prepl data is parseable in ANY environment.
Then the prepl client can decide to keep treating the response as just a string or it can try to parse it in whatever way it deems correct.
So yeah, don't provide data as data in a prepl payload from an env because the string serialisation doesn't always match up on the other end.
I can patch it if you don't have time but yeah, small nuance that I know of. I should really write up a "prepl spec" that I've inferred since it isn't documented.
I've been patching Clojure and ClojureScript to bring both of their prepl implementations inline with each other 😬
https://github.com/Olical/conjure-shadow-cljs-example demo repo is here for when it returns strings 😄
Oh the other thing to check: When an exception is caught it should return the data in :val
as a string (output of Throwable->map
I think?) then set :exception
to true on the top level of the message.
I have a patch going into the next ClojureScript version which sets this :exception
flag.
And one into the next Clojure version which allows reader conditionals (ClojureScript already has them).
https://oli.me.uk/clojure-prepl-for-tool-authors/ for future reference, I've written up how prepls should respond / work
Huh, I didn’t realize shadow-cljs.server didn’t get updated along with the cli, it’s not in my does
Hi, how can I require a package with shadow-cljs ? Like this fs = require('fs');
thanks ! 🙂
Have a question about node_module resolution https://github.com/thheller/shadow-cljs/issues/547
as a concrete example, im currently using the package react-bootstrap
. when building with the :browser target, the build fails because react-bootstrap
has the dependency @restart/hooks
, which we dont find since we arent traversing child node_modules
directories.
what is the correct way to handle this? do i install @restart/hooks
in the parent node_modules
directory? if so, are upgrades of sub dependencies like @restart/hooks
expected to be handled manually?
https://github.com/thheller/shadow-cljs/issues/547 kinda surprises me
package manager hoisting (pulling nested packages to the toplevel) is considered an implementation detail
different package managers handle hoisting differently
some don't hoist at all
I think I've seen cases with yarn where the resolution for a conflict was to hoist neither
@mazin you install @restart/hooks
in the same package.json
where you installed react-bootstrap
basically you manually resolve the conflict. that saves you from including the same package twice. thats the whole reason it doesn't look into nested folders
ok thanks, that makes sense. what's the reason for avoiding looking into nested folders for packages that only appear once in the entire project, nested or otherwise? if the main motivation is to avoid including duplicate packages, seems ok to recurse nested folders and include packages that are only found once