Fork me on GitHub
#clojurescript
<
2017-07-17
>
qqq00:07:58

@darwin : are you aware of any codebases that writes a nrepl client in cljs over websocket? (I'm looking for codebases to read / study)

qqq00:07:18

(pinging you directly given the insane things you've already done with dirac / nrepls)

qqq07:07:32

what is the most lightweight websocket library out there?

pesterhazy08:07:26

just use js/websocket !

pesterhazy08:07:43

no library needed afaict

hlolli09:07:54

Is there a way to have google closure minify in such a way that symbols do not start alphabetically (a,b,c,d). Tried confuscate.js but it slows down the code too much. I'm in a bit of "my boss told me so" situation, the symbols just can't start alphabetically. Someone has ideas?

pesterhazy09:07:06

there's :pseudo-names?

hlolli09:07:17

nice nice, didn't know of that one, thanks!

pesterhazy10:07:02

it's even less obfuscating than the default, so it may not help with your problem

darwin10:07:35

@qqq there is no nrepl client implementation in cljs AFAIK

hlolli10:07:48

yes, it's used seemingly for debugging. It's not helping with my problem, but I'm glad to learn about this anyway.

pesterhazy10:07:04

what could possible be a reason for the "non-alphabetical" requirement?

hlolli10:07:22

we want to "make it harder" to decypher the production code. How I see it, if someone wants to decypher a js code, he's/she's going to succeed, just a question of how much pain that person needs to go trough.

hlolli10:07:03

we were using yps gen from yahoo (before I started), I'm hoping we can stop using that.

hlolli10:07:07

I think I may end up with using confuscate on a low setting, (still almost 2x larger), describing symbols in unicode bloats the code. But hides it a bit yes.

ajs11:07:46

I have an older cljs codebase that integrates fine with a third-party js library in both simple and advanced optimizations. Without changing any code, I upgraded to cljsj 1.7+. It still runs fine in simple opts. But when I compile my codebase with advanced, I get strange undefined errors from the other library. My guess is renaming is at issue. However, the functions it says are not defined are not functions I call in my own code. Any idea what could be the cause of this when simply upgrading cljs?

darwin11:07:32

@ajs multiple possible reasons: 1) upgrade of Google Closure Compiler which does different/more aggressive renaming 2) new version of ClojureScript compiler which emits javascript with different structure 3) undefined behaviour - your code was invalid before, but the bug didn’t manifest until the code got shuffled in a different way 4) something else

ajs11:07:21

if I call out to a third-party js function, that function should be in an extern. but if that function then calls another function in its own internal library, that shouldn't concern my extern file, right?

ajs11:07:12

ok, that's strange. runtime error for a function i never knew existed, but only with advanced. i'll keep digging.

darwin11:07:35

:pseudo-names is your friend

darwin11:07:56

so that 3rd party library is outside of your cljs build, right? is it minified?

ajs11:07:04

yes it is

ajs11:07:04

that is, i include it directly on the html page with a script tag, and then i call functions within it using js/

darwin11:07:18

this sounds like a naming clash, some fn in your 3rd party lib got renamed to abc and cljs :advanced build happened to rename some of its function to abc, then your 3rd party lib is calling your lib unintentionally

darwin11:07:48

if you use non-minified version of your 3rd party lib, the problem is much less likely, because closure compiler tries to generate very short names and the names in the lib will likely be human-readable 🙂

ajs11:07:33

the actual undefined/not-found error is for a var that is human readable. the minified library isn't as minifed as an advanced compilation, so it contains functions like "readFile"

ajs11:07:58

but that is an idea to try the non-minified and see what happens

darwin11:07:08

have to go, good luck

oskarkv14:07:05

Does anyone know how to get figwheel to work with Electron? I'm having trouble. When I run Electron it says "Figwheel: trying to open cljs reload socket" and then nothing else.

fedreg15:07:32

Hi all, what do I need to do to bring in clojure.spec into my project? Just :require [clojure.spec :as s]? On cljs v. "1.9.229" Do I need the clojure 1.9 alpha? thx!

mfikes15:07:23

@fedreg You can use Clojure 1.8.0. The only thing you lose by not having the clojure.spec.alpha Clojure namespace available is having macro specs checked.

fedreg15:07:04

@mfikes Ahh, I see. Well no need for that at this point anyways. Thanks for the info!

mfikes15:07:08

@fedreg With ClojureScript 1.9.229 you’d also need an older Clojure (one that has the clojure.spec namespace) anyway. FWIW, in case you go down that path.

mfikes15:07:27

(For the same reason—macro checks.)

n0namae16:07:06

Hi! What framework are you using for interface? Should I learn some bootstrap after basic cljs?

mfikes16:07:09

The ClojureScript compiler has a guard, and if it can’t find that namespace, it just skips checking macro specs.

urbank16:07:01

So apparently I have much still to learn. I am at a loss as to how to use the output of clojurescript for development when the html is served by a server and not localhost.

urbank16:07:04

I'm getting Not allowed to load local resource: file:///.../out/goog/base.js . Could someone kindly point me to what I should study to understand and resolve this?

bajrachar16:07:34

@urbank - of the top of my head - I am thinking you might need to compile with "min" profile if you'r using lein

bajrachar16:07:49

I am also new to clojurescript

noisesmith16:07:55

wait, does that mean you have a file:/// url in your script tags?

pesterhazy16:07:07

@urbank are you using the cljs REPL?

pesterhazy16:07:07

was my fault as it turned out

urbank16:07:15

@bajrachar Yeah, I think it would work then, but I need the non-single-file version for development (figwheel). @noisesmith Hm.. yes. In the other version it is localhost. I suppose it's because I used an absolute path, because my lein project isn't in the same folder as the actual application @pesterhazy Yep using cljs REPL, figwheel. I'll check out if the issue is relevant to me. I have a feeling I'm making some more fundamental mistake because I don't know what I'm doing when it comes to this.

pesterhazy16:07:16

what url are you opening in the browser?

urbank16:07:14

@pesterhazy So um, excuse my ignorance, but turns out I actually am on local host. So the original question is the wrong one. I'm just not using the figwheel server, but just the output from the compiler. Accessing url localhost:8000/WebSite/default/index. The index.html has a script tag that loads the main.js file which in turn writes a goog/base.js and cljs_deps.js, however the path to goog/base.js and cljs_deps.js is an absolute path from "C:/...". So the browser doesn't allow those two to load. Hm... is it that my :output-to/`:output-dir`/`:asset-path` are absolute paths? I think there's quite a few things here that I don't know that I don't know.

noisesmith16:07:52

yeah - a file:/// url in an actual app makes no sense - because your client won’t have the files in the right place right? and it would be a security issue even if they did - you need to serve up all the proper artifacts from your webserver - even in dev mode you should not have file urls in your html

urbank16:07:34

@noisesmith Yeah, I assumed I could do this for development, whereas in production it would just be one file anyway.

urbank16:07:56

I'll get rid of the absolute paths

urbank17:07:07

Ok, I've managed to get it working. It was mostly the absolute path. It's working, but for some reason react isn't getting mounted on the #app div.

urbank18:07:50

Eh, never mind. It was just that the div was before script file requiring the main.js file