Fork me on GitHub
#cljs-dev
<
2020-04-16
>
ak-coram09:04:31

feels like there's a new CLJS release looming, is there anything blocking it?

henryw37412:04:56

@dnolen I've been getting my head around what you said re: https://clojurians.slack.com/archives/C07UQ678E/p1586970679096300 and Krell etc. Although I think I understand this now, I don't feel like the news announce and the amended webpack guide make the picture as clear as it could be wrt cljs libraries having npm dependencies - how current tools support this, how they might in future etc. If I find time I could try adding PR's for what I think is missing to explain: "You can now publish ClojureScript libraries that depend directly on the JavaScript ecosystem without additional ceremony and be confident that the whole community can benefit regardless of what other JavaScript and ClojureScript build tools they may prefer." FWIW I've made a repo that follows the new webpack guide, but tries to depend on a lib that declares :npm-deps https://github.com/henryw374/cljs-webpack-bundle-using-lib-with-npm-deps . As you say 'cljs is currently either all Closure or :bundle' so this is not expected to work. I guess another angle on this is that afaik cljs libs using foreign code (e.g. the popular cljs react libs) will probably not yet be dropping cljsjs dependencies in favour of :npm-deps. It's actually not clear that a majority of potential users have any npm setup at all (but it'd be good if the Clojure survey asked this explicitly )

dnolen12:04:55

@henryw374 you need to run clj -m cljs.main --install-deps to actually get the :npm-deps

dnolen12:04:09

getting the deps and the bundle stuff are independent things

henryw37413:04:05

right! although now I add :install-deps true to build.edn I get Execution error (ClassCastException) at cljs.closure/maybe-install-node-deps! (closure.clj:2588).

dnolen12:04:21

@henryw374 reagent already supports using react from :npm-deps instead of CLJSJS

dnolen12:04:32

we'll cover the lib publishing part in a separate guide, the webpack guide doesn't cover the install step because in this case it doesn't need to

👍 1
frozar12:04:43

Hi folks, I'm working on the cljdoc-analyzer project and I got a failure by analyzing specter 1.1.3 package in cljs environment. After some works, I realised that the call of cljs.analyzer.api/analyze-file function on the specter.cljc file produce a crash. I'm definitely not able to figure out what's wrong. So to help the investigation, I create a demo repo of this crash: https://github.com/frozar/cljdoc_specter_support As the specter package can be use in any cljs project, maybe the call to the cljs.analyzer.api/analyze-file function is not good in the repo above. On the other hand, maybe the parse step of cljs.analyzer.api/analyze-file simply failed on this file (for a reason which has to be highlighted). I would like to understand what is wrong here, to be able to fix cljdoc-analyzer. If anyone has a clue, I would appreciate ^^

dnolen13:04:35

@fabien.rozar what is the stack trace?

frozar14:04:28

If you will, I share the generated file here.

frozar14:04:06

I also add the stack trace to the repo, just in case.

martinklepsch16:04:48

@dnolen here’s a link to view this outside slack, I’ve looked at this before and couldn’t make much sense of it so we’d very much appreciate your eyes on this 🙂 😄 https://github.com/frozar/cljdoc_specter_support/blob/master/resources/clojure-7761295136030698780.edn

dnolen13:04:45

@henryw374 what is the full stack trace?

henryw37413:04:38

Attached file. to recreate, clone that repo and run 'clj -m cljs.main -co build.edn -v -c -r'

dnolen14:04:24

@henryw374 minor thing but remove :install-deps from your config

dnolen14:04:13

@henryw374 what JDK are you using?

dnolen14:04:29

that stacktrace is very strange

henryw37414:04:44

but how else to get the :npm-deps picked up, other than including :install-deps compiler opt? I'm on openjdk 11.0.2.

dnolen14:04:10

@henryw374 try with JDK 8 please

dnolen14:04:29

@henryw374 :install-deps doesn't pick up :npm-deps

henryw37414:04:19

ah, got it. it modifies package.json. then you proceed with whatever webpack,shadow etc as normal:+1:

dnolen14:04:35

it triggers an install on every build

dnolen14:04:43

you almost never want it

dnolen14:04:51

I'll probably deprecate this option in the future

dominicm14:04:01

If you deprecate, what's the api equivalent? A function that takes the config? Asking because I use cljs programmatically.

dnolen14:04:54

@dominicm deprecation doesn't really mean removal

dnolen14:04:02

just an warning of some of some kind discourage future use

dominicm14:04:30

I know. But if I'm not using cljs.main, I don't know how to install deps otherwise.

dominicm14:04:37

I try to keep up with changes to apis.

dnolen14:04:38

the warning won't be at the level of the API - probably only cljs.main

dnolen14:04:46

so you'll be fine

dominicm14:04:08

Ah, so cljs main will deprecate it, not the api. Cool.

dnolen14:04:21

fwiw we fully embrace the Rich Hickey stance on API changes - i.e. NO

dnolen14:04:14

@henryw374 all of this needs a lot of documentation - i understand why you might be confused

henryw37414:04:48

great. I think I did know about this a few years ago 😉

dnolen14:04:09

well probably the only thing that might ever cause an API change is project sustainability

dnolen14:04:55

like dropping all the less used REPLs in the next release - but that's really a special case

dnolen16:04:28

@fabien.rozar @martinklepsch let not use threads in this channel

👍 1
dnolen16:04:01

@fabien.rozar the stack trace says the failure is in Clojure

dnolen16:04:03

not the analyzer

dnolen16:04:26

and it gives a precise location, please drop a link to that failing line in the original source

dnolen16:04:40

are you sure the version of Clojure you're running has coll?

dnolen16:04:54

the likelihood that the exception is wrong is small

frozar17:04:21

In the project.cljs of this minimal repo, I specified [org.clojure/clojure "1.10.1"] I can use the coll? function from a clojure REPL in this minimal repository... For me, I think I have the coll? function and this exception doesn't make sense. @dnolen can you reproduce the bug locally? You just need to clone the repo and make lein run to get it (normally...).

dnolen17:04:31

sorry I don't have time to look at that

dnolen17:04:50

an exception like that is almost never wrong

dnolen17:04:55

the failure is in Clojure

frozar17:04:16

You right, is a kind of Clojure question, but this exception appear by using a function from [cljs.analyzer.api :as ana], that's why it seems to be related to ClojureScript... Maybe I should post it in the #clojure channel.

dnolen17:04:01

@fabien.rozar actually it might not be I'm not really what's going on in that trace

dnolen17:04:15

it looks like it's wrapped in something, sorry

martinklepsch17:04:57

@fabien.rozar let’s get together and try to further reduce the repro

👍 1
dnolen17:04:36

@fabien.rozar what version of ClojureScript is this?

dnolen17:04:18

the other possibilty is that your ClojureScript version is wrong

dnolen17:04:55

hrm yeah no way coll? has existed since 2011

dnolen17:04:00

@fabien.rozar that namespace ... is complicated

dnolen17:04:11

I suspect there's a macro bug here - if so there's nothing you can do about it

frozar17:04:39

I use [org.clojure/clojurescript "1.10.597"] just in case

frozar17:04:33

@martinklepsch yes, I think the best would be to get a more synthetic example...

dnolen17:04:37

I looked a bit more closely at the source and trace - I really don't know - seems weird - agree that making a more minimal example would be useful