Clojurians
#cljs-dev
<
2016-11-10
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

mhuebert13:11:35

Hi all, I’ve spent a couple days working on packaging dependencies for use with the self-hosted compiler in browser environments. I’m not sure what else is being done here, or what an ideal approach would look like, but I’ve got a few things working: Examples - https://cljs-live.firebaseapp.com/ Source - https://github.com/mhuebert/cljs-live

dnolen13:11:28

@mhuebert cool stuff!

richiardiandrea15:11:08

@mhuebert some time ago I also wrote a boot task for collecting source files and move them to a path, ready for self-host *load-fn*: https://github.com/Lambda-X/boot-pack-source

jrheard17:11:43

@viebel will probably be super interested in these messages

viebel17:11:36

@jrheard thanks. I’m looking at it

viebel17:11:12

@mhuebert did you try to use your packages inside klipse with the external-libs url parameter

mhuebert17:11:41

@viebel nope, but i’ll have a look!

viebel17:11:40

also @mhuebert I cannot open https://cljs-live.firebaseapp.com/ inside chrome

viebel17:11:44

https security issues

mhuebert17:11:18

hmm, what does it say?

viebel17:11:12

Sorry. It works. It’s just that I’m on a very slow connection

mhuebert17:11:26

ah. and the payloads are big.

viebel17:11:51

yeah self-hosted cljs cannot be advanced compiled :disappointed:

mhuebert18:11:56

have you noticed any differences between (ns my-ns.core (:require …)) vs. (require ‘[..])? Some of my examples don’t work unless I use the (ns..) form and i’m not sure why

viebel18:11:31

what examples?

mhuebert18:11:25

unfortunately you can’t reproduce it exactly on that webpage, because so long as any (ns ..) form has been loaded, there is no problem. But both the goog.events and quil examples fail if they are run before a ns form.

mhuebert18:11:00

anyway I just thought there might be a known difference. i’ll track it down

mhuebert18:11:32

it was something about supplying a quoted symbol as the :ns option to the compiler

viebel18:11:10

@mhuebert can you come to the #klipse channel?

anmonteiro22:11:31

@dnolen have you ever tried loading foreign libraries with Self-hosted CLJS + Node.js?

dnolen22:11:39

@anmonteiro nope

anmonteiro22:11:52

I found something which I'm not sure it's a bug in the compiler or not.

anmonteiro22:11:34

so because foreign-libs (in CLJSJS, at least) are packaged as UMD modules, requiring them in Node.js (where module is present) won't actually side-effect the global scope

anmonteiro22:11:07

so to make it work currently I have to:

(with-redefs [js/module js/undefined]
      (js/eval source))

dnolen22:11:36

right you have to replicate what we do for ClojureScript Node.js REPLs

anmonteiro22:11:52

oh, where can I find that code?

anmonteiro22:11:02

not a bug in the CLJS compiler then :slightly_smiling_face:

dnolen22:11:18

bootstrap_node.js

dnolen22:11:13

has to load before anything else

dnolen22:11:35

many annoyances of Node.js are circumvented here

dnolen22:11:41

including reloading of libs

anmonteiro22:11:08

oh there you go

anmonteiro22:11:23

you also set module to undefined

anmonteiro22:11:12

@dnolen is this bootstrap_node.js only run for REPLs or appended to :target :nodejs builds too?

dnolen22:11:57

you need it regardless if you’re not building a single file

anmonteiro22:11:59

oh right, I'm building with :simple so that's why I'm not seeing it

anmonteiro22:11:38

hrm seems my problem is a bit different though

anmonteiro22:11:14

I think I just need to do this when requiring foreign-libs

anmonteiro22:11:25

I can't think of anything else for which this is needed

richiardiandrea23:11:28

So (lazy question) @anmonteiro is lumo a self hosted repl or fully fledged? Good job, I tried it and it is fast!

anmonteiro23:11:53

@richiardiandrea what's your difference between self hosted and fully fledged? :slightly_smiling_face:

richiardiandrea23:11:00

Mmm maybe I am wrong and not up to date then :smile:

anmonteiro23:11:54

not your problem, it's just I don't understand what you're asking

richiardiandrea23:11:59

Actually if there is parity, especially in macro management, it should not matter

richiardiandrea23:11:19

Fully fledged in my mind still needs java

anmonteiro23:11:57

oh no, it's self-hosted then

anmonteiro23:11:07

there's no Java involved

richiardiandrea23:11:28

Awesome, are you using inf-clojurebwith that?

anmonteiro23:11:42

not yet, but I plan to add support for a socket REPL

anmonteiro23:11:27

anyway, let's move this somewhere else, folks might not be interested in Lumo talk in this channel :slightly_smiling_face:

richiardiandrea23:11:35

Yep cool i'll check there I did not notice I received a notification in my email, thanks!