Fork me on GitHub
#shadow-cljs
<
2018-11-08
>
thheller07:11:34

@loganpowell you missed the upgrade message I guess. shadow-cljs 2.7.0 REQUIRES CLJS 1.10.439

thheller07:11:47

I guess you are using lein or deps.edn and did not do that upgrade?

thheller07:11:03

it has nothing to do with the JDK. I'm using openjdk myself

thheller07:11:24

nevermind .. its actually a bug in the REPL code

thheller08:11:49

should be fixed in 2.7.2

nbdam09:11:42

2.7.2 repl works for me..

Logan Powell10:11:01

@thheller thank you. I was going crazy.

achikin10:11:46

@thheller btw. When I'm using reagent with npm React with shadow-cljs do I need to exclude cljsjs/react from reagent dependency and add empty cljsjs/react ns definitions to the project or it is taken care of automatically?

thheller10:11:23

its taken care of automatically. cljsjs is just ignored and won't be used so besides the extra download it doesn't hurt

👍 4
thheller10:11:27

no need to exclude

thheller10:11:59

only manual thing you need to do currently is npm install react react-dom create-react-class

thheller10:11:07

since reagent currently does not declare those dependencies properly

achikin10:11:45

@thheller and no need for externs also?

thheller10:11:45

should be fine without yes. turning on externs inference just in case helps though https://shadow-cljs.github.io/docs/UsersGuide.html#infer-externs

thheller10:11:18

reagent/re-frame all build fine without though

👍 4
Logan Powell12:11:54

@thheller do you have a patreon?

Logan Powell12:11:26

I would like to support your work

thheller12:11:48

currently not no. I started the setup but never finished it.

Logan Powell12:11:16

Please do, I think others might be happy to help you help them

thheller12:11:44

will do soon

nha12:11:09

You may be interested in giving to clojurists together: https://www.clojuriststogether.org/news/q3-2018-funding-announcement/

Logan Powell12:11:43

I will do that, but I also want to support your work directly

❤️ 4
wilkerlucio13:11:59

@thheller hello, I did the upgrade here, I noticed now we are back on logging the warnings every time for third part libraries (before they usually only happened in first compile if I remember right), was this change intended?

thheller13:11:34

no intended change there no?

thheller13:11:34

but you may be getting new warnings that weren't there before due to the stricter checks regarding symbols with dots

pepe13:11:22

I actually started to get warning on every compile with specter. And pretty weird ones:

------ WARNING #1 --------------------------------------------------------------
 File: com/rpl/specter.cljc:1275:19
--------------------------------------------------------------------------------
1272 |           ns (namespace structure)]
1273 |       (cond (keyword? structure) (keyword ns new-name)
1274 |             (symbol? structure) (symbol ns new-name)
1275 |             :else (i/throw-illegal "NAME can only be used on symbols or keywords - " structure)
-------------------------^------------------------------------------------------
 Use of undeclared Var com.rpl.specter/java
--------------------------------------------------------------------------------
1276 |             ))))
1277 | 
1278 | (defnav ^{:doc "Navigates to the namespace portion of the keyword or symbol"}
1279 |   NAMESPACE
--------------------------------------------------------------------------------

------ WARNING #2 --------------------------------------------------------------
 File: com/rpl/specter.cljc:1288:19
--------------------------------------------------------------------------------
1285 |           new-ns (next-fn (namespace structure))]
1286 |       (cond (keyword? structure) (keyword new-ns name)
1287 |             (symbol? structure) (symbol new-ns name)
1288 |             :else (i/throw-illegal "NAMESPACE can only be used on symbols or keywords - " structure)
-------------------------^------------------------------------------------------
 Use of undeclared Var com.rpl.specter/java
--------------------------------------------------------------------------------
1289 |             ))))
1290 | 
1291 | (defdynamicnav
1292 |   ^{:doc "Adds the result of running select with the given path on the
--------------------------------------------------------------------------------

pepe13:11:40

As there is no java ns

thheller13:11:50

interesting. I'll check

4
pepe13:11:25

I actually do not think it is shadows fault. But too low knowledge here

wilkerlucio13:11:03

yeah, I think the initial warning is ok, but I remember we this discussion before about then showing up after the first compile

thheller13:11:43

yeah that behavior should not have changed

thheller13:11:09

@pepe its a problem in specter that just wasn't "detected" previously

thheller13:11:51

com.rpl.specter.NAME_transform_STAR_ = (function com$rpl$specter$NAME_transform_STAR_(structure,next_fn){
var new_name = (function (){var G__36732 = cljs.core.name(structure);
return (next_fn.cljs$core$IFn$_invoke$arity$1 ? next_fn.cljs$core$IFn$_invoke$arity$1(G__36732) : next_fn.call(null,G__36732));
})();
var ns = cljs.core.namespace(structure);
if((structure instanceof cljs.core.Keyword)){
return cljs.core.keyword.cljs$core$IFn$_invoke$arity$2(ns,new_name);
} else {
if((structure instanceof cljs.core.Symbol)){
return cljs.core.symbol.cljs$core$IFn$_invoke$arity$2(ns,new_name);
} else {
throw (new java.lang.IllegalArgumentException(com.rpl.specter.impl.smart_str.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["NAME can only be used on symbols or keywords - ",structure], 0))));

}
}
});

thheller13:11:07

gotta find the code that is actually responsible for generating this

thheller13:11:21

but throw (new java.lang.IllegalArgumentException... is certainly not valid JS 😉

thheller13:11:44

#?(
   :clj
   (defmacro throw-illegal [& args]
     `(throw* IllegalArgumentException ~@args))

😀 4
thheller13:11:54

yeah thats not gonna work 😛

Logan Powell13:11:40

I can confirm that I have been some "new" errors from third-party libraries (Specter included)

thheller13:11:31

examples? I might need to remove the new checks if its gets too much

Logan Powell13:11:08

But I'd rather know now that this won't work in javascript then trying to debug after release 😄

thheller13:11:59

uhm what is defun?

Logan Powell13:11:20

(defun ... is a third-party library

thheller13:11:30

why is your code full of stuff leading with a .? .defun .deploy_cencus_function

thheller13:11:34

thats not normal

Logan Powell13:11:12

I barely ever use the . notation

Logan Powell13:11:26

unless I'm interop'ing with js

thheller13:11:30

that would not emit that either

thheller13:11:36

I think something else is broken in that macro

pepe13:11:37

but when I look into specter/impl.cljc where the macro is defined, there is cljs version too:

#?(
   :clj
   (defmacro throw-illegal [& args]
     `(throw* IllegalArgumentException ~@args))


   :cljs
   (defn throw-illegal [& args]
     (throw (js/Error. (apply str args)))))

thheller13:11:19

yeah its confusing because of the self-conflict it has

thheller13:11:29

macro comes before fn so the CLJS version is never used

pepe13:11:43

Ok. I thank you sir!

pepe13:11:46

yeah from the Issue I can understand it

Logan Powell13:11:27

That might be the issue with defun as well. It's a macro over the core.match macro 😄

thheller13:11:50

no, thats different. not the same name

Logan Powell13:11:06

is it something I'm doing wrong?

Logan Powell13:11:41

btw, I can also confirm that - besides the new error - it looks like AdoptOpenJDK is now working 😉

Logan Powell13:11:04

bye bye Larry Ellison

Logan Powell13:11:19

Don't know if it will help, but here's the log from my repl

thheller13:11:36

23 | (defun.core/defun deploy-census-function
-------^------------------------------------------------------------------------
IllegalArgumentException: Invalid signature "..." should be a list
	clojure.core/assert-valid-fdecl/fn--8348 (core.clj:7405)
	clojure.core/map/fn--5587 (core.clj:2747)
	clojure.lang.LazySeq.sval (LazySeq.java:40)
	clojure.lang.LazySeq.seq (LazySeq.java:49)

Logan Powell13:11:16

sorry, I truncated the code

thheller13:11:21

@loganpowell in the output above I can't see what you did

thheller13:11:52

I assume you sent something via nrepl?

Logan Powell13:11:01

Cursive (IDEA)

Logan Powell13:11:11

nrepl (remote)

thheller13:11:24

yeah. I'mm gonna need what you sent 😛

thheller13:11:42

but yeah I can't get defun to work at all

Logan Powell13:11:59

Just the args?

thheller13:11:11

what did you send before that?

thheller13:11:23

must have done a require or so

Logan Powell13:11:53

wait, now it's not throwing the error

Logan Powell13:11:09

let me track this down a bit more

Logan Powell13:11:15

could be me making a stupid mistake

thheller13:11:00

ok the problem is that the error ends up in the wrong place

thheller13:11:09

should be output to the REPL but ends up in the server console

thheller13:11:24

I can fix that part but defun still doesn't like the code

Logan Powell13:11:15

let me work on it

thheller13:11:03

it is odd that you get such weird code output

thheller13:11:12

for me it just doesn't output anything and fails completely

Logan Powell13:11:13

don't worry about it... It probably has something to do with all the reorganization of the code I did to get namespaces looking like https://shadow-cljs.github.io/docs/UsersGuide.html#_the_classpath

Logan Powell13:11:27

intellij freaked out

Logan Powell14:11:28

Please let us know when you have the Patreon setup.

Logan Powell14:11:07

In the meantime, just wanted to say that I believe the work you're doing is really important for the future of ClojureScript

❤️ 4
Logan Powell14:11:11

The existing tooling is - by far - the biggest barrier for newbs

Logan Powell14:11:03

I think you should rename it to "lumin" instead of "shadow" 😄

thheller14:11:42

naming is hard and renaming everything is too much work 😉

😀 4
Logan Powell14:11:22

it's just so much "easier" than anything else...

Logan Powell14:11:41

"bringing cljs into the light"

Logan Powell14:11:19

anyway, enough gushing... I'll be bach

hlolli15:11:13

Not sure if I can Händel it.

😂 4
manandearth16:11:07

I am looking for a dataviz library to use with clojurescript. My background is not Javascript so importing and using d3 seems complicated from cljs . The most promising library for my purpose is hanami https://github.com/jsa-aerial/hanami/blob/master/src/cljs/aerial/hanami/core.cljs . Yet loading the ns raises the following error: >conflict on "h-box" by "re-com.box" used by "re-com.core" I think it's to do with cljsjs packages required in the library. It requires:

[cljsjs.vega]
   [cljsjs.vega-lite]
   [cljsjs.vega-embed]
   [cljsjs.vega-tooltip]
as well as:
[re-com.core
    :as rcm
    :refer [h-box v-box box gap line h-split v-split
            button row-button md-icon-button md-circle-icon-button info-button
            input-text input-password input-textarea
            label title p
            single-dropdown
            checkbox radio-button slider progress-bar throbber
            horizontal-bar-tabs vertical-bar-tabs
            modal-panel popover-content-wrapper popover-anchor-wrapper]
    :refer-macros [handler-fn]]
   [re-com.box
    :refer [h-box v-box box gap line flex-child-style]]
   [re-com.dropdown
    :refer [filter-choices-by-keyword single-dropdown-args-desc]]

   [aerial.hanami.utils
    :refer [title2 href]]

thheller18:11:38

both re-com.core and re-com.box have a :refer for h-box (and others)

thheller18:11:05

that is not valid. granted that CLJS doesn't validate this by default

thheller18:11:52

importing d3 is not complicated at all. just (:require ["d3" :as d3]) and then (d3/whatever ...)

manandearth08:11:42

do I not need to add dependencies to the package.json file? is npm install d3 all I need?

manandearth08:11:25

I see about the conflicting refers...

thheller09:11:34

npm install d3 will add it to package.json automatically yes

manandearth13:11:17

I can't seem to get very far with this. is:

(def circle-demo
  (
   -> d3  
      (.select "#myCircle")
      (.append "svg")
      (.attr "r" "30")
      (.attr "cx" "50")
      (.attr "cy" "50")
       (.attr "fill" "grey")
   )

  )
a valid syntax? That's with "d3" required as d3

thheller17:11:30

yes that looks correct

hyoo17:11:36

hi, shadow-cljs doesn't seem to recognize a new cljs file when it is added in src and doesn't load the file automatically to repl. Is there a way to fix that?

wilkerlucio17:11:51

files never get loaded automatically, you have to require it from another file that's already been used, or manually load the file into the REPL (using the load file feature from your editor)

hyoo19:11:39

cool. thanks!

richiardiandrea20:11:20

I have a problem in downloading transitive dependencies from deps.cljs in shadow...it looks like it does not read our custom registry setting in .npmrc...has anyone tried that?

richiardiandrea21:11:49

uhm it looks like shadow is trying to guess, I have just discovered the :managed-by option 😄

richiardiandrea21:11:41

but I don't see where it should go actually