Fork me on GitHub
#clojurescript
<
2017-08-31
>
dnolen00:08:25

@lxsameer React works there’s nothing really the matter with it and React Native would take a lot effort. It’s not a complicated choice IMO.

lemontea16:09:48

@lxsameer @dnolen On the other hand I've heard news about React's license gotcha (example analysis: https://medium.com/@dwalsh.sdlr/react-facebook-and-the-revokable-patent-license-why-its-a-paper-25c40c50b562 ) and this may drive some people to seek alternatives (whether you agree with them or not) :thinking_face:

lxsameer16:09:18

Yeah I heard about those problems. Some people moved to preact because of that and I think it would be awesome to reagent and om if they can use preact under the hood as well

lxsameer16:09:19

but as @dnolen mentioned RN is another important concern. To be honest I can picture clojurescript community to have a pure cljs vdom and react alternative but reinventing RN would be a huge pain

lemontea16:09:11

Yup, React Native is sort of a monopoly in its niche - tough luck!

Jon05:08:32

@lxsameer I made one with pure ClojureScript called Respo http://respo.site but it lacks some features to make it really useful in old browsers.

Jon05:08:19

The nice part is I can implement the virtual DOM with persistent data structure thus it reuses old virtual DOM tree well. But I'm not sure if it can perform better in performance.

gklijs06:08:48

I want to have some simple way to edit html for the website for my girlfriend, I found this https://github.com/Alex-D/Trumbowyg/blob/develop/src/trumbowyg.js which seems to do what I need, and also I already am using jquery. I’m just in doubt whether to try to rewrite it into clojurescript or not. It would make it easier to do things like saving the data, otherwize I would have to get the data back from the dom again, which is also not a big problem. Has anobody experience with converting js to clojurescript?

sam1606:08:24

How to add 3rd party react native library like react-native-material-design in cljs project made with expo using lein new exponent proj-name.?

dm307:08:10

does anyone know what changed in recent Clojurescript versions that makes js/process evaluate to #js {:env #js {:NODE_ENV development}} under e.g. Phantom? Used to be nil under 1.9.562

anmonteiro08:08:03

@dm3 set :process-shim false

dm308:08:31

@anmonteiro thanks! Pardon my ignorance, but how is that flag useful?

anmonteiro09:08:12

@dm3 when processing JS modules through Closure we need to emulate the Node runtime

anmonteiro09:08:30

Where certain libraries dispatch on production vs development

anmonteiro09:08:47

Using process.env.NODE_ENV

dm309:08:23

what’s then the future-proof way to check if js/process is usable? E.g. I have to determine whether to use process.nextTick or goog.async/nextTick in a library.

anmonteiro09:08:48

People shouldn't be using the process shim in Node

anmonteiro09:08:06

Or any env that exports process

anmonteiro09:08:15

This may need more education/docs

dnolen10:08:11

@dm3 it would seem better in your case to check for Node target not process directly

dm310:08:07

@dnolen thanks, I’ll look at doing that

dnolen11:08:38

@dm3 at runtime cljs.core/*target* is a thing

dnolen11:08:07

only catch is that it’s value is a string since it’s a Closure define

hkjels11:08:18

I have a package that uses foreign-libs and :optimization :simple; when I use it from another project it works well in dev-mode, but with release (`:optimization :advanced`) it fails.

hkjels11:08:31

What am I missing here?

dnolen11:08:12

@hkjels probably externs

dnolen11:08:25

but saying it “fails” is skipping a lot of useful information for someone else to help you 🙂

hkjels11:08:00

@dnolen variables from those external-files are missing, yes

hkjels11:08:04

I’ve created an externs-file, but there might be some issue with it that I’m not qualified to see

hkjels11:08:11

I also tried :infer-exters, but same result really

dnolen11:08:14

the error will tell you which externs are missing

dnolen11:08:46

you can recover the original name by using :pseudo-names true, make it look nicer with :pretty-print true

hkjels11:08:53

OK, so with :pseudo-names true I could basically use a CDN right?

hkjels11:08:29

I’ll just end up with somewhat larger output

hkjels11:08:36

There’s no problem with concatenating two libs and creating an extern for it right=

dnolen11:08:41

I’m telling you how to debug your problem

dnolen11:08:52

if you’re OK with a giant payload then use :simple

dnolen11:08:30

@hkjels you need to be a bit more clear “concatenating two libs” what does this mean?

dnolen11:08:33

two JS libs?

hkjels11:08:12

yeah, basically cat file1.js file2.js > use.js

hkjels11:08:58

Ohh, I think I’m more in-tune with the purpose of all this now

dnolen11:08:41

concatenating two JS libs then using that as foreign lib - no issues

dnolen11:08:55

you still need to supply externs

hkjels11:08:56

and externs are the methods we use of those libraries

dnolen12:08:04

@hkjels yes, if you haven’t looked a this yet - this is required reading https://developers.google.com/closure/compiler/docs/api-tutorial3

dnolen12:08:25

not just methods, any properties that come from some foreign thing Closure Compiler will never see

anmonteiro12:08:51

@hkjels ^ FWIW this is the big selling point of the new NPM module support

anmonteiro12:08:27

before: we prepend foreign JS libs to the output of Closure advanced compilation

anmonteiro12:08:43

after (now!): Closure sees processed JS modules and in some cases doesn’t need externs

hkjels12:08:47

I think I’m hitting an issue with the particular thing I’m trying to mangle. When I use an extern instead of :infer-extern I get SEVERE: ERROR - Duplicate extern input

dnolen12:08:56

that error doesn’t have anything to do with :infer-externs (unless you can demonstrate something minimal that shows that)

dnolen12:08:07

the error means you’ve submitted the same externs file twice

hkjels12:08:02

Yeah, but I haven’t.. With a full project-search it’s only referenced from deps.cljs

dnolen12:08:13

@hkjels you may think you haven’t but somehow it is happening

dnolen12:08:17

otherwise you wouldn’t get that error

dnolen12:08:41

what is your :externs value?

dnolen12:08:45

in your project

hkjels12:08:48

do you mean the file-path? “js/signal-r.ext.js”

dnolen12:08:32

right so that’s not a file path

dnolen12:08:40

that’s a resource path

dnolen12:08:24

so if that somehow appears in multiple places on the classpath, you will pass dupes to Closure

dnolen12:08:39

(.. (Thread/currentThread) (getContextClassLoader) (getResources "js/signal-r.ext.js")) (In a Clojure REPL)

dnolen12:08:20

if that’s not it then you could debug this by calling in cljs.closure/get-upstream-deps* at a REPL and seeing what got duped

hkjels15:08:23

Got it running! parrot

dnolen15:08:42

@hkjels ok, but what was the problem? 🙂

hkjels16:08:55

It was my understanding of boot

hkjels16:08:55

you need to have source-path both in source-path and resource-path, but having the extern in both places messes it up

hkjels16:08:40

it’s not logical to me and I’m kind of not using the features of boot, so I think I’ll stick with leiningen for most of my clojure-needs from now on

hkjels16:08:39

only thing in favor, is that I can compile garden along with clojurescript with a single command

bendlas17:08:22

I'm using :preloads to monkey-patch createClass onto React v16 this works perfectly in dev mode, but not in advanced. Is there any proper solution for this, short of forking cljsjs.react?

dnolen17:08:13

@bendlas using :preloads under :advanced is not really a supported thing

dnolen17:08:19

so in this case you’re likely on your own

bendlas17:08:35

@dnolen I'll work around it for now, but ticket welcome?

dnolen17:08:56

@bendlas no, we have no intention of supporting :preloads under advanced sorry

dnolen17:08:59

it’s not for that

dnolen17:08:24

it’s an injection for dev time only

dnolen17:08:50

we even emit a warning about this so I’m not sure what you are expecting

bendlas17:08:57

I read that

bendlas17:08:13

I'd expect the same thing as for :none something that is ordered, as if required before requiring any app namespace

bendlas17:08:35

to set up polyfills, dom magic, global state, ...

bendlas17:08:48

if preloads is not the right thing for that, what is?

dnolen17:08:49

I don’t really have anything more to say about this

dnolen17:08:02

I’m not sure why you have those expectations, but I would lose them

dnolen17:08:43

all this said try master and it might work for you

dnolen17:08:48

but this not a promise we will ever make

bendlas17:08:21

oh, did something change in that regard since last release?

dnolen17:08:57

yes there was a implementation detail bug around :npm-deps

bendlas17:08:12

so obviously, you don't see a problem in designing such a flag, but you don't want to promise behavior and support it, right? so that means, that you think it's a worthless use case?

dnolen17:08:23

I already said that

dnolen17:08:35

sorry also in the middle of other things, need to close this conversation 🙂

dnolen17:08:23

“worthless use case” I’m not even talking about that

dnolen17:08:37

but this isn’t what :preloads is for, anyways done for now

cemerick17:08:22

funnily, this is only going to fail for deps that have a first letter that correspond with an ascii control char

dnolen17:08:06

@cemerick so file a bug 🙂

cemerick17:08:42

@dnolen I will, just spelunking a bit. All the fancy module stuff is new since I've been in here

dnolen18:08:17

@cemerick def, if you want to help out some would be glad to take it 🙂

cemerick18:08:30

@dnolen minor parse error on that last message, but :thumbsup: regardless

cemerick18:08:39

putting a patched build through some paces now

cemerick18:08:27

@dnolen that I haven't been filing tickets and otherwise causing a ruckus is mostly just a sign that you and the team have been doing good work 😄

cemerick18:08:43

hopefully I did the patch attach and tag dance right, it's been a while 🙂

dnolen18:08:05

cool thanks