Fork me on GitHub
#clojurescript
<
2017-07-13
>
gdeer8101:07:49

I posted my complaints in beginner channel but I wanted to ask here since someone here has run into this issue. How did you work around fetching data from a server that doesn't support CORS?

noisesmith01:07:51

mostly what you suggested, doing the request from my own app backend - it makes things much simpler

gdeer8101:07:34

awesome, thanks 😃

minikomi04:07:06

If it supports JSONP, I’ve used goog.net.Jsonp before

kommen07:07:42

is it possible with shadow-cljs to use a different :optimizations for different modules?

thheller08:07:47

@kommen no, :optimizations is always whole program

robert-stuttaford08:07:44

so i’ve been pointing https://github.com/danvk/source-map-explorer at our advanced-mode js. it only shows the stuff that the cljs compiler produces, because it’s looking at the source maps. is it possible to also bring in source maps for all the preamble cljsjs deps, so that they can also be visualised in the same diagram?

juhoteperi10:07:19

@robert-stuttaford cljsjs foreign-libs, probably not, but it should be possible to include Closure modules (`goog.*`, processed JS modules etc.) in source-map

juhoteperi10:07:12

Possible, as in, it will need work on ClojureScript compiler to support this

robert-stuttaford11:07:10

that’s what i thought, thanks @juhoteperi ! so goog.* already shows in this map, btw. perhaps happy magical things happen once the new npm goodies land

juhoteperi11:07:36

Huh, I was looking at source-map-explorer and didn't see goog.* modules

benbot14:07:38

Does boot-reload mantain state like figwheel does? If not, is there another plugin that would add that feature?

jeremys14:07:42

@benbot Hey ben, the short answer is yes. The long answer is neither actually maintains state. Usually your state is gonna be in an atom defined with defonce which prevents re-defining it. It is not that these tools maintain state, it is that the way we code apps lends itself to hot code reload pretty well.

benbot14:07:49

Okay cool, I knew that to keep that state you needed to put it in an atom, I just wasn’t sure if boot-reload would reset the atom or not

benbot14:07:51

Thanks 🙂

benbot14:07:07

I’m trying to see what all the boot hype is about

jeremys14:07:10

also a dirty trick one can use is (defonce foo (init-state)) so that your initialisation code is called just once

jeremys14:07:27

lol I czn understand that, boot is pretty cool. There is a boot channel if you wanna check it out.

timgilbert14:07:34

Anyone else having periodic failures downloading the clojurescript-1.9.671 jar from clojars? I am getting sporadic build failures that seem to be caused by this

timgilbert14:07:03

lein deps gives me: >Could not transfer artifact org.clojure:clojurescript:jar:1.9.671 from/to central (https://repo1.maven.org/maven2/): Read timed out >Could not find artifact org.clojure:clojurescript:jar:1.9.671 in clojars (https://clojars.org/repo/)

timgilbert14:07:26

Hmm, maybe network issues from circleci or something, everything looks hunky-dory from here. 🤷

martinklepsch14:07:27

@timgilbert I thought Clojurescript is distributed via maven central

martinklepsch14:07:41

Ah yeah, but I guess it can’t download from central, and then it can’t find it on clojars, these errors make sense 😄

timgilbert14:07:56

Yeah. I'm guessing it's a circleci network issue or maybe a bad mirror in maven or something. I have a support ticket in to circleci.

pandeiro15:07:23

Does the new feature rely on npm to install the packages locally (I assume there's no built in npm compatible client)?

pandeiro15:07:09

I was confused though b/c of the version numbers in the :npm-deps map

anmonteiro15:07:34

@robert-stuttaford just a thought: not really important to have those show because there's really nothing you can do to slim them down

anmonteiro15:07:04

Even though it's a bummer because source map explorer can't tell you the actual size of your bundle

anmonteiro15:07:51

As Juho said, I also didn't see goog things in my bundle. Would be interested if you could share a viz where they appear

anmonteiro15:07:13

@pandeiro :npm-deps will shell out to NPM

pandeiro15:07:56

@anmonteiro Thanks, and does it depend on npm for anything else, such as the Babel transforms, or is that handled inside the Closure compiler?

anmonteiro15:07:48

The beautiful thing about preprocessing is you can write them yourself :-)

anmonteiro15:07:53

Post still to come

anmonteiro15:07:31

@pandeiro which means you can to module preprocessing in nashorn, rhino, shell out to node, you name it

pandeiro15:07:14

Great work everyone

robert-stuttaford15:07:11

@anmonteiro seeing it is valuable; one might decide to drop a dep entirely 🙂 the three we did of various cljs apps (not libraries) all had small bits of goog.* in them

fedreg16:07:23

Hi all, what is the proper way to map values into a select fields options? This (map #[:option {:value %} %] (SongTitles)) gets me a Reader tag must be a symbol error and can’t seem to figure out how to get it. (SongTitles) returns a list of Strings. thx!

anmonteiro16:07:49

@fedreg replace # with (fn [x] [:option ...])

fedreg16:07:33

@anmonteiro Ahh, thx! I thought those were the same thing. Does not work with []?

anmonteiro16:07:49

the syntax for an anonymous function is #( ...)

anmonteiro16:07:11

to return a vector from an anonymous function you’d have to do: #(do [:option ...])

anmonteiro16:07:45

in Lumo:

cljs.user=> (macroexpand '#(do [:option {:value %}]))
(fn* [p1__3#] (do [:option {:value p1__3#}]))
cljs.user=>

fedreg16:07:46

ok. Left out the do and received an arity error without it. Thanks for clarifying!

anmonteiro16:07:38

@fedreg without the do it’ll try to call the vector. see the expansion:

cljs.user=> (macroexpand '#([:option {:value %}]))
(fn* [p1__6#] ([:option {:value p1__6#}]))
cljs.user=>

fedreg16:07:05

yup, makes sense. thx!

plins18:07:07

hello everyone, sorry for the dumb question, but i cant find the solution in google how im supposed to disable a input using hiccup?

plins18:07:35

<input type=“text” name=“lname” disabled> if id translate this to a map, it wouldnt have an even number of elements

rgdelato18:07:02

I believe you'd do {:disabled true} or {:disabled "disabled"}?

plins18:07:29

ive tried {:disabled true} let me check everything again thx

pesterhazy18:07:57

in reagent it's {:disabled true}

tech_hutch20:07:50

Hm. I wonder why Slack considers the file to be binary.

roklenarcic20:07:40

so if I understand correctly, javascript libraries are just prepended to compiled result and dead code optimization doesn't work on them?

mobileink20:07:02

i suspect the answer is: it depends. 😉 there are js libs, and then there are js libs.

mobileink20:07:16

js libs that are closure-compatible will be optimized, afaik.

mobileink21:07:56

the "not an island" blog article dnolen posted the other day says: "ClojureScript is now smart enough to find these CommonJS modules and process them into Google Closure Compiler compatible code." does this mean that js code will be closure-optimized even if it is not written to closure's restrictions (https://developers.google.com/closure/compiler/docs/limitations)?

mobileink21:07:37

"This is a big deal" - indeed!

dnolen21:07:19

as stated elsewhere there are caveats - but for many modern style JS libs this likely won’t be an issue

dnolen21:07:42

also it encourages ClojureScript developers to reach out to critical libs and make whatever small tweaks are necessary to make them Closure compatible

dnolen21:07:51

these changes are often simple and boring

dnolen21:07:28

prior to this change we didn’t really even have a compelling reason to do so

dnolen21:07:34

this changes everything

mobileink21:07:58

you can say that again. hyuuuge!

dnolen21:07:00

there’s also community work underway to continuously build the most critical libs

dnolen21:07:20

as people transition to Node modules, that will also help catch issues

mobileink21:07:34

the mind boggles. we can thank maria geller for (much of) this? i think we need a "Contributor of the Year" award.

mobileink21:07:47

i'll pony up one bottle of Malort. Second place is two bottles.

roklenarcic21:07:34

so right now, I'm using Materials-UI and Om.next. Will this change mean I won't get whole React in my production build anymore if authors of those two libs changed their libraries to use node.js modules?

dnolen21:07:56

@mobileink yes she did the groundwork for many of these enhancements - there were lots of details to sort out later which is why it took so long to wrap up - and some things came by surprise and solved problems for us (Closure Node JS module resolution)

mobileink21:07:03

cool. wherever you are, maria geller, thank you bigly! there's a bottle of Malort with your name on it in Chicago.

roklenarcic21:07:41

What's Malort?

mobileink21:07:28

ok, stupid question time. Polymer uses bower. can cljs deal directly with bower stuff? i'm afraid i dunno a whole lot about such stuff.

roklenarcic21:07:07

oh it's a swedish liqueur

dnolen21:07:08

@mobileink we don’t integrate with Bower, and we’re probably not going to

mobileink21:07:03

@dnolen ok thanks. time to beat up the polymer folks, ha.

mobileink21:07:22

fwiw it looks like the polymer folks are working on npm support.

dnolen21:07:00

we’re unlikely to support anything other than node_modules

dnolen21:07:26

for everything else we have a new feature coming down the pipe which allows people to use externally built stuff in a completely idiomatic way

dnolen21:07:58

this includes foreign libs like on CLJSJS

dnolen22:07:57

We encourage everyone to give master a try, we’re planning on releasing right before EuroClojure next week

dnolen22:07:02

building from source is pretty easy if you have Maven installed (easily done via your favorite package manager) https://clojurescript.org/community/building

jeremys23:07:47

wow I just re-read the post on modules and wow I didn’t get all that it could do the first time I read it but wow this is indeed huge. I just got my mind blown. wow