This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-16
Channels
- # aleph (2)
- # beginners (68)
- # boot (25)
- # bristol-clojurians (5)
- # cider (10)
- # cljs-dev (60)
- # cljsrn (1)
- # clojure (138)
- # clojure-austin (1)
- # clojure-france (2)
- # clojure-greece (11)
- # clojure-italy (4)
- # clojure-russia (16)
- # clojure-spec (4)
- # clojure-uk (75)
- # clojurescript (26)
- # core-async (28)
- # cursive (25)
- # data-science (4)
- # datomic (16)
- # defnpodcast (2)
- # devops (2)
- # docs (10)
- # duct (11)
- # emacs (1)
- # events (1)
- # figwheel (8)
- # fulcro (61)
- # garden (2)
- # hoplon (6)
- # java (6)
- # jobs-discuss (1)
- # lein-figwheel (14)
- # leiningen (86)
- # luminus (11)
- # off-topic (8)
- # parinfer (9)
- # pedestal (2)
- # re-frame (19)
- # reagent (1)
- # ring (3)
- # ring-swagger (8)
- # shadow-cljs (278)
- # spacemacs (13)
- # sql (5)
- # testing (7)
- # unrepl (8)
- # yada (25)
Seeing the HUD crash with this:
failed to parse websocket message {:type :build-failure, :build-config {:target :browser-test, :test-dir "resources/public/js/test", :ns-regexp "-test$", :runner-ns gondola.client.client-test-main, :devtools {:http-port 8022, :http-resource-root "public", :http-root "resources/public/js/test"}, :id :test, :build-id :test}, :report "------ ERROR -------------------------------------------------------------------\n File: /Users/tonykay/owsy/gondola-client/src/cljs/gondola/client/smartystreets.cljs:13:1\n--------------------------------------------------------------------------------\n 10 | ([id] [::address-result id])\n 11 | ([id field] [::address-result id field]))\n 12 | \n 13 | (defsc AddressResult [this {:keys [id]}]\n-------^------------------------------------------------------------------------\nSyntax Error at gondola.client.smartystreets:13\n{:cause clojure.lang.ExceptionInfo: Invalid arity for query {:expected 0, :got 1}}\nExceptionInfo: Syntax Error at gondola.client.smartystreets:13\n\tclojure.core/ex-info (core.clj:4739)\n\tclojure.core/ex-info (core.clj:4739)\n\tfulcro.client.primitives/defsc (primitives.cljc:3203)\n\tfulcro.client.primitives/defsc (primitives.cljc:3142)\n\tclojure.core/apply (core.clj:661)\n\tclojure.core/apply (core.clj:652)\n\tcljs.analyzer/macroexpand-1*/fn--3565 (analyzer.cljc:3286)\n\tcljs.analyzer/macroexpand-1* (analyzer.cljc:3285)\n\n--------------------------------------------------------------------------------\n 14 | {:ident (fn [] (address-result-path id))\n 15 | :query '[*]})\n 16 | \n 17 | (defmutation get-street-address [{:keys [id] :as params}]\n--------------------------------------------------------------------------------\n", :e clojure.lang.ExceptionInfo: failed to compile resource: [:shadow.build.classpath/resource "gondola/client/smartystreets.cljs"] {:tag :shadow.build.compiler/compile-cljs, :source-id [:shadow.build.classpath/resource "gondola/client/smartystreets.cljs"], :url #object[java.net.URL 0x71843d1d "file:/Users/tonykay/owsy/gondola-client/src/cljs/gondola/client/smartystreets.cljs"], :file #object[java.io.File 0x1367c8aa "/Users/tonykay/owsy/gondola-client/src/cljs/gondola/client/smartystreets.cljs"], :line 13, :column 1, :source-excerpt {:start-idx 9, :before [" ([id] [::address-result id])" " ([id field] [::address-result id field]))" ""], :line "(defsc AddressResult [this {:keys [id]}]", :after [" {:ident (fn [] (address-result-path id))" " :query '[*]})" "" "(defmutation get-street-address [{:keys [id] :as params}]"]}}}
The REPL experience is also less than ideal (using 2.1.11). I get things like Error handling response - class java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.CharSequence
for expressions like (+ 1 1)
noob question ๐ Is it technically really hard to have figwheel with shadow-cljs ? In the latest defn-podcast think Bruce mentioned that he's planning on working on the internals of figwheel to make it more flexible.
@claudiu The hot code reloading is done by shadow-cljs, as is the compiling. Figwheel is both of those, but with the stock compiler. So, the short answer is โno, you donโt use figwheel with shadow-cljsโ
@claudiu the question would be "why would you want to use figwheel with shadow-cljs?". what does figwheel provide that you do not get yet?
@thheller They seem to be two things that do the same thing. I get why it does not work out of the box, was just curious, it could theoretically work, with some updates to figwheel that made it more modular . ๐
shadow-cljs is much more low level than figwheel so it really wouldn't be practical to use figwheel for anything
I have never used figwheel so I might totally be missing something obvious ... so if you have something that shadow is missing over figwheel .. tell me.
So far so good. More of a noob question ๐ since figwheel does hot reloading and is the 'default' in the clojurescript community, was just wondering if there technical aspects to why not work on integrating vs making the hot-reload from scratch ๐ . Was listening to the defn podcast, Bruce said something about figwheel updates (can't remember exactly what), I immediately thought about shadow-cljs ๐
figwheel has had much more work done on the usability front and yes I'd love to use some of that
@thheller following Tony comments, the only thing that I miss from Figwheel at this point is the REPL, it works really well there, but in shadow I've had problems with timeouts and sometimes not loading files at all
other thing that I miss, but I think it's not directly a shadow concern, is been able to start my REPL directly from Cursive, with Figwheel I can create a run with clojure.main
pointing to a tiny script that starts figwheel, this boots up the compilation and with a REPL ready to use, with shadow I have to do it in 2 steps (open the process in a terminal and connect via nREPL on Cursive)
other than that, only love ๐ and a special congrats on allowing external source paths, this is so good to work while developing multiple libs (I have a project where I'm having to use devbuilds for pathom, inspect and fulcro, without shadow it would be very painful)
sure, one moment
figwheel.clj
(use 'figwheel-sidecar.repl-api)
(start-figwheel! "devcards" "test")
(cljs-repl)
(require '[shadow.cljs.devtools.server :as server])
(require '[shadow.cljs.devtools.api :as shadow])
(require '[shadow.cljs.devtools.cli])
(server/start!)
(shadow/watch :devcards)
(shadow/watch :test)
figwheel seems to choose it kind by random (probably a (first)
on a map), but you can type :cljs/quit
, it takes you to a place where you can select which REPL to connect
just tried running the script, got this:
objc[32799]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/bin/java (0x10ce484c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10ced44e0). One of the two will be used. Which one is undefined.
Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: es5>= in this context, compiling:(shadow/build/cljs_hacks.cljc:439:22)
oh, sorry, so the project.clj version matters on this case, because of cursive classpath, correct?
the lein file on this project was just a dump one for cursive, the real deps were in shadow, let me update and try again
I hope this gets better with deps.edn
does shadow supports deps.edn
?
cool, is there something on the guide about it? I tried to find these days but I failed
cool ๐
the script now ran
during the start it generated a lot of those:
Feb 16, 2018 11:48:15 AM clojure.tools.logging$eval27442$fn__27445 invoke
INFO: duplicate resource goog/locale/scriptToLanguages.js on classpath, using jar:file:/Users/wilkerlucio/.m2/repository/org/clojure/google-closure-library/0.0-20170809-b9c14c6b/google-closure-library-0.0-20170809-b9c14c6b.jar!/goog/locale/scriptToLanguages.js over jar:file:/Users/wilkerlucio/.m2/repository/org/clojure/google-closure-library/0.0-20170519-fa0499ef/google-closure-library-0.0-20170519-fa0499ef.jar!/goog/locale/scriptToLanguages.js
Feb 16, 2018 11:48:15 AM clojure.tools.logging$eval27442$fn__27445 invoke
INFO: duplicate resource goog/positioning/anchoredviewportposition.js on classpath, using jar:file:/Users/wilkerlucio/.m2/repository/org/clojure/google-closure-library/0.0-20170809-b9c14c6b/google-closure-library-0.0-20170809-b9c14c6b.jar!/goog/positioning/anchoredviewportposition.js over jar:file:/Users/wilkerlucio/.m2/repository/org/clojure/google-closure-library/0.0-20170519-fa0499ef/google-closure-library-0.0-20170519-fa0499ef.jar!/goog/positioning/anchoredviewportposition.js
no, they are not ๐
and the REPL experience seems limited, it seems to don't understand some REPL send commands:
[0:0]~cljs.user=> 3
3
[0:0]~cljs.user=> 4
4
[0:0]~cljs.user=> (in-ns 'com.wsscode.pathom.book.graphql.fulcro-network.demos)
Feb 16, 2018 11:51:36 AM clojure.tools.logging$eval27442$fn__27445 invoke
WARNING: client sent unknown msg {:type :repl/set-ns-complete, :id 7, :ns com.wsscode.pathom.book.graphql.fulcro-network.demos}
Timeout while waiting for REPL result.
[0:0]~com.wsscode.pathom.book.graphql.fulcro-network.demos=> (css/upsert-css "token-demo" RequireTokenApp)
#object[HTMLStyleElement [object HTMLStyleElement]]
[0:0]~com.wsscode.pathom.book.graphql.fulcro-network.demos=> {:map "with content"}
{:map "with content"}
[0:0]~com.wsscode.pathom.book.graphql.fulcro-network.demos=> [:book] Compiling ...
[:book] Build completed. (317 files, 2 compiled, 0 warnings, 0.78s)
the output is not been formatted, seems like something is missing to cursive to understand
it was better on the nREPL version
no, just an information at start, then no logs
(only responses)
WARNING: client sent unknown msg {:type :repl/set-ns-complete
will be gone in next version.
cool ๐
there is another one like this:
Feb 16, 2018 11:58:03 AM clojure.tools.logging$eval27442$fn__27445 invoke
WARNING: client sent unknown msg {:type :repl/require-complete, :id 10}
makes sense
I like the logs too, would be nice if they could live together
this message seems to come now and then: Timeout while waiting for REPL result.
nice ๐
[2018-02-16 22:42:59 - WARNING] TCP Port 9630 in use.
BindException: Address already in use (Bind failed)
java.net.PlainSocketImpl.socketBind (PlainSocketImpl.java:-2)
java.net.AbstractPlainSocketImpl.bind (AbstractPlainSocketImpl.java:387)
java.net.ServerSocket.bind (ServerSocket.java:375)
java.net.ServerSocket.<init> (ServerSocket.java:237)
shadow.cljs.devtools.server.socket-repl/start (socket_repl.clj:161)
shadow.cljs.devtools.server.socket-repl/start (socket_repl.clj:153)
shadow.cljs.devtools.server/start-system (server.clj:157)
shadow.cljs.devtools.server/start-system (server.clj:132)
error Command failed with exit code 1.
info Visit for documentation about this
which doesn't seem all that useful given that you can just look at the files directly
or I can add a http://localhost:9630/ports or so page
or you simly RUN shadow-cljs cljs-repl foo
instead of connecting to any socket at all
not sure how it interacts with my toolchains, but at current I can accept random ports, as long as I can find the ports easily.
that seems like a horrible way to find out about a port but I can add that if you want
https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/cursive_repl.clj
nrepl always looks at .nrepl-port
yes. but that belongs to lein
and I don't want to conflict with that
well, just new stuff to JavaScript, we don't read files from browsers before. not seen in Node.js also.
anyway, I barely read those files, it's not in my toolchains yet. Reading them from logs is the most natural way for me.
does it need an update in the docs? https://shadow-cljs.github.io/docs/UsersGuide.html#http
somehow I want to see how you use shadow-cljs in you browser apps... just want to find out how mach difference out there
I thought about writing that down somewhere. Probably would make it easier to understand why certain things are the way they are
I need to rethink some of my toolchains also. Habits brought from JavaScript to Clojure, not all of them are good.
I'm haveing a situation where I have two builds :admin and :public, with shadow-cljs watch admin
it starts the http server for :public as well as :admin. Is it possible to prevent this?
it starts the http server because I wanted to be able to use them with compile
and release
off-topic, you seem the have mastered the urban dictionary more than anyone here on the slack, but nice to learn abbreviations like PITA along clojurescript ๐
@wilkerlucio 2.1.13 should fix the REPL issues you had
also fixed an issue where the build would get stuff if a macro had errors, changes to that would not trigger a reload.
@thheller I donโt know if you did something specific to fix my protorepl issue, but if not, whatever you did in 2.1.13 fixed it
iโll do a bit more investigation. its going to be annoying because things arenโt erroring, they are timing out
@thheller confirmed that changing ns and loading file are working now ๐
is this expected behavior? when i connect to my app using shadow-cljs cljs-repl app
, I get a timeout trying to switch to a library (and I confirmed that Iโm connected to the browser by logging there first)
[3:1]~com.rpl.specter=> (js/console.log "***")
nil
[3:1]~com.rpl.specter=> (in-ns 'com.rpl.specter)
Timeout while waiting for REPL result.
the timeout causes bad things to happen in atom protorepl (a spinner shows up in the buffer and never goes away), but i wonder why iโm getting timeouts to begin with
I tried to go back to terminal usage, now I'm getting:
shadow-cljs - config: /Users/wilkerlucio/Development/pathom-book/shadow-cljs.edn version: 2.1.13
shadow-cljs - socket connect failed, server process dead?
is there a way to force the clean up, or check for it?
entering a meeting now, will check a bit later
@thheller other random question: it looks like you used asciidoctor to compose the user guide? i started using gitbook to do something similar but it doesnโt understand clojure. are you happy with asciidoctor?
kind of. I recently found slate which look a bit better but no idea if it supports clojure. https://lord.github.io/slate/
asciidoctor is probably better all around but slate definitely looks neat for API docs
I just upgraded to the latest version, and the REPL experience in IntelliJ is better, but still gives some errors on output.
If I use the โsend to REPLโ for something in a comment block like (defn g [a] (js/console.log :HI a))
, I see the error Failed to parse client result: No dispatch macro for: '
actually, this is perhaps a better representation of the output:
(def h (f/debounce g 1000))
Failed to parse client result: No dispatch macro for: '
=> "#'the-ns/h"
so it does give back a string of what the def returnedโฆeverything โworksโโฆitโs just a bit misleading/annoying
@thheller just FYI, running shadow-cljs stop
fixed the start issue, after that it ran fine
interesting, how much different it is from the current impl?
I couldn't figure out why results from the shadow-cljs were always displayed as a string
but instead I'm supposed to set :printed-value
on the message and just pass the string along
so 2.1.14
on the way? ๐
@thheller just tried, but got some problems, the nrepl is not responding, and I see this on the shadow-cljs terminal:
If I run something like a react DOM render by accident it causes an exception on the client, then I get no more REPL output. If this helps, it is the js console message:
encoding of result failed TypeError: Cannot convert a Symbol value to a string
at Array.join (native)
at Function.cljs.core.str.cljs$core$IFn$_invoke$arity$1 ()
at Object.cljs$core$pr_writer_impl [as pr_writer_impl] ()
at cljs$core$pr_writer ()
at
at Object.cljs$core$pr_sequential_writer [as pr_sequential_writer] ()
at Object.cljs$core$print_prefix_map [as print_prefix_map] ()
at cljs$core$print_map ()
at Object.cljs$core$pr_writer_impl [as pr_writer_impl] ()
at Object.cljs$core$pr_writer [as pr_writer] () {$$typeof: Symbol(react.element), type: "div", key: null, ref: null, props: {โฆ}, โฆ}
Restarting nREPL fixes it (do not have to restart shadow)I noticed any command I type on the REPL generate one of those
and :code
is whatever I sent
mine seems to got totally borked, nothing that I send to the REPL is working
2.1.15?
@tony.kay the symbol issue is this one https://dev.clojure.org/jira/browse/CLJS-1628
cool, sends are back on nREPL here
one more thing: when using figwheel repl Intellij is able to recognize it's cljs and switch the repl for it (there is combobox to switch), but on shadow it can't and I have to manually change it
I think worth asking on #cursive, colin surely knows how it happens ๐
ah, you changed for :cljs/quit
and it did the trick?
yes, confirmed, thanks for such quick fixes ๐
if you find anything else let me know. I barely ever use the CLJS REPL so I never noticed these things
yeah, I guess after years of really bad REPL's on CLJS people just got used to live without it, but for me it's very important part of my workflow
I can understand that. what I do is that while writing functions, I just keep doing small changes and running on the REPL, that's the fastest feedback loop I know about, specially when writing data transformations