Fork me on GitHub
#clojurescript
<
2020-06-11
>
khaled06:06:35

Morning. I’m building a reframe/reagent/react UI with https://github.com/stripe/react-stripe-js and https://github.com/stripe/stripe-js for payment. I’m using shadowcljs with npm packages. I got an issue where the optimizations :advanced of clojurescript is breaking the code. In fact the property createPaymentMethod of stripe object is undefined when running with the optimizations. My code is similar to this example https://github.com/stripe/react-stripe-js/blob/master/examples/hooks/0-Card-Minimal.js#L31 Perhaps the issue comes from stripe-js because it’s only a wrapper to download js module and initialise a stripe object https://js.stripe.com/v3 Someone has an idea?

thheller07:06:38

@khaled.basbous turn on externs inference. it'll likely tell you were the problem is and you just add a ^js typehint https://shadow-cljs.github.io/docs/UsersGuide.html#externs

👀 4
khaled07:06:22

@thheller thanks a lot, you are amazing !!!

😎 4
💯 4
sova-soars-the-sora13:06:46

I don't want to pollute the chat with my err logs, but I am getting java.xml.Bind not found errors on compile of newly cloned cljs projects... I tried adding :jvm-opts ["--add-modules" "java.xml.bind"] but the error then is

Compiling ClojureScript... Error occurred during initialization of boot layer java.lang.module.FindException: Module java.xml.bind not found
Subprocess failed

sova-soars-the-sora13:06:52

Any pointers appreciated ^.^

alexmiller14:06:12

that used to be included in the jdk but t hey pulled it out in newer jdks

👁️ 3
alexmiller14:06:41

you can explicitly include javax.xml.bind/jaxb-api instead as a dependency

sova-soars-the-sora14:06:54

I actually just updated the version numbers in the project file and it works now

sova-soars-the-sora14:06:02

but thank you I found that line as well

sova-soars-the-sora14:06:13

I almost never update version numbers of dependencies ... do you recommend running lein-ancient when getting a new clone offa github?

sova-soars-the-sora14:06:13

Hmmm. it's missing from the JDK... thanks

martin hablak14:06:11

Hello, what do you use to / how you measure clojurescript test coverage?

sova-soars-the-sora14:06:50

@martin.hablak how do you mean? to make sure all your functions have tests?

martin hablak14:06:21

yes, to see what parts of code are covered by tests @U3ES97LAC

martin hablak14:06:25

I see there is tool for clojure, but I can not find anything for clojurescript

sova-soars-the-sora15:06:23

Hmm, wish I had a lead for you there..

ai21298317:06:33

Hello guys. I'm pretty sure I am missing something, but I can't get :source-map to work properly. In https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/closure.clj#L1408, emit-optimized-source-map function is spitting source map to the file, while passing the same file to source map https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/source_map.cljs#L198. As a result, source map is pointing to itself and not working. Can't imagine this bug wasn't spotted yet, must be I am missing something. Any help would be much appreciated.

dnolen17:06:29

@ai212983 need more information, source-maps under advanced should work but it's not going to be that accurate

dnolen17:06:01

source maps are best during development. Can you provide more information about what you are trying to do?

ai21298317:06:43

@dnolen I am trying to make a production build and provide it with source map for sane error logs

ai21298317:06:15

so its advanced optimizations, source-map enabled

ai21298317:06:35

problem is there is no way i can configure file source map is pointing to.

dnolen17:06:54

right so like I said you should not expect to find this all that useful, it works and can provide some hints while debugging

dnolen17:06:09

but advanced optimization really make it impractical for accuracy

dnolen17:06:42

it exists mostly so you can get a hint about where things went wrong

dnolen17:06:49

but in my experience :pseudo-names is way more useful

ai21298317:06:04

I am confused. Right now generated source map is pointing to itself. Is it expected behaviour?

dnolen17:06:15

that said, what you've described doesn't make sense

dnolen17:06:43

make something minimal that demonstrates the issue please, no tooling except for ClojureScript and tools deps

emak19:06:19

Thank you @ai212983 for pinpointing the origin of the issue. That could explain why after uploading my sourcemap to sentry I still can't see cljs code there.

ai21298316:06:38

@UC0JV84JF I've ended up with adding sed call into my makefile. But I'd rather liked to see it fixed, of course 🙂

emak19:06:10

same fix here for the file property 😉, although my problem with sentry is a bit deeper.

ai21298317:06:46

imo code is talking for itself. spitting source map and passing same file as a parameter

ai21298317:06:06

(working on minimal example)

lilactown17:06:40

https://github.com/tc39/proposal-record-tuple JS proposal for immutable records (key/value) and tuples (random access)

lilactown17:06:19

the 😭 part is that the current proposal disallows mutable objects inside of records or tuples

orestis17:06:29

Why is that bad?

noisesmith17:06:33

at a first glance I like that suggestion

noisesmith17:06:07

I can imagine we'd end up with people using "index maps" used to join immutable tokens to mutable things that should be associated.

lilactown17:06:30

that’s basically what they are proposing to do in userland

lilactown17:06:40

it seems very inefficient

noisesmith17:06:15

yeah, the index maps would be an added complexity as collatoral damage basically

noisesmith17:06:19

but it's a common pattern

lilactown18:06:31

like, it prevents functions and dates from being put in

noisesmith18:06:03

yeah I see how much of a pain in the ass that would be the idea that functions and dates aren't already immutable is another can of worms entirely of course

p-himik18:06:51

A new proposal in 5 years or so: "Let's make a version of functions and dates that's immutable".