This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-25
Channels
- # admin-announcements (3)
- # alda (2)
- # beginners (10)
- # boot (44)
- # cider (31)
- # cljs-dev (5)
- # cljsjs (2)
- # cljsrn (17)
- # clojure (181)
- # clojure-austin (2)
- # clojure-brasil (18)
- # clojure-canada (1)
- # clojure-conj (5)
- # clojure-dev (11)
- # clojure-gamedev (30)
- # clojure-russia (380)
- # clojure-spec (50)
- # clojure-uk (35)
- # clojurescript (146)
- # clojutre (1)
- # component (1)
- # cursive (62)
- # datomic (27)
- # dirac (7)
- # editors (23)
- # emacs (7)
- # events (34)
- # funcool (22)
- # hoplon (134)
- # jobs (22)
- # jobs-rus (7)
- # juxt (1)
- # kekkonen (1)
- # lein-figwheel (54)
- # leiningen (7)
- # luminus (2)
- # off-topic (5)
- # om (4)
- # onyx (27)
- # proton (5)
- # protorepl (2)
- # re-frame (16)
- # reagent (29)
- # rethinkdb (2)
- # schema (1)
- # untangled (61)
- # yada (9)
When ClojureScript is compiling (and recompiling) with :none
optimisations, is there a defined ordering to which file will be written out last?
I’m trying to use Karma to run tests when my CLJS autobuilds, but it detects the changes in earlier files being written, while later ones haven’t been written, which breaks the JS loading
I can add a delay, but that is not ideal
@danielcompton - can you use the notify command? as hideous as that is
Ah yeah that will work, forgot about that one. Will give it a try
What I have done in the past is keep tests watching, but use the notify command to touch
a file that is being watched
Rather than run the tests directly from the notify command
(if your test runner has the ability to watch and test different files)
Any idea what this means for clojurescript? https://github.com/google/closure-compiler-js
@rickmoynihan: nothing for clojurescript ATM IMO, maybe future possibility for :advanced compilations with bootstrapped clojurescript
yeah - was wondering if it would possibly untether it from the jvm dependency
@shaunlebron: Thanks for the tip! 🙂
@rickmoynihan there’s never going to be a plan around that
but a ton of work has gone into making it possible to solve that problem if they care about it and willing to put in the rest of the work
dnolen: cool - the JVM dependency certainly isn't a problem for me - was just curious
@rickmoynihan yes it’s isn’t for most people 🙂 and it’s just a lot of work we don’t have time for. But there’s no reason to get in the way of making it possible - thus bootstrapped.
dnolen: I'm not really a clojurescripter - so I just follow it casually - I'd got the sense that the bootstrapping work implied this was a goal... but what you're saying makes perfect sense to me
hi all. Is it possible to make a plugin for the cljs compiler? Or a plugin into closure compiler? I want to operate on my javascript between the cljs -> js step and the js -> closure-ified js step
does anyone here use Httpurr? I’m trying to set withCredentials = true
for the XHRio object but I’m not sure how to modify a reified object.
might have to change to cljs-ajax if it’s not possible
@kingoftheknoll hi! you can access the raw xhr
object in the -xhr
attribute, hope it helps!
@dialelo could you elaborate? would that be off the client param that’s passed the the send!
?
@kingoftheknoll let's move to #funcool for not flooding this channel, happy to elaborate there
@dnolen thanks. I had a brief conversation with someone in the #clojurescript IRC channel suggesting I could write a one-off script of my own using the cljs.compiler.api
and cljs.build.api
it's not quite the same as writing a plugin but as long as I can go cljs -> js
, then my own js -> js
, and then js -> closure -> optimized js
, I don't mind writing my own script for it
(that is, easily follow each of those steps, presumably by leveraging the api of the cljs compiler)
@nickt yes you could do something like that, :none
doesn’t use Closure Compiler so you could operate on those files
@dnolen and then is it easy to invoke Closure Compiler via the cljs build api on the JS files after I've done my js -> js
step?
@nickt: alternative idea: I would simply privately fork clojurescript and spend time on writing a simple shell script auto-rebasing my changes on top of official one, then use the fork in my project, I expect adding support for custom js post-processing step is something like an one-line patch so there should not be much headache to roll on top of clojurescript master 🙂
looks like I could hook right into https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/closure.clj#L856 in a small fork
and lein install
works in clojurescript repo to build it and install it locally, just replace version in project.clj (if needed)
well, I’m not that much familiar with cljs code base, but I would put it right before Google Closure compiler invocation
you don’t, just if you wanted to distinguish it from 0.0-SNAPSHOT 🙂 https://github.com/clojure/clojurescript/blob/master/project.clj#L1
all we ever do is feed those to Closure Compiler, you can do whatever you want with those files
yea I have a little project that I'm hacking through and I see that :none yields just normal js files
but it's unclear to me how to feed those back into the cljs compiler for the closure step
so you can probably accomplish what you want, but replicating everything is probably going to be a non-trivial amount of work for you
in anycase, like I said this just isn’t really supported and you’re going to be on your own for the most part
probably would be willing to consider a patch that allows custom passes - but it’s also not a priority
@dnolen thanks, i see. I'm definitely thinking about @darwin's suggestion there... looking through the compiler API it seems like I could probably hook into compile-file
or some similar function pretty easily
@nickt: why don’t you hook just before optimization step? see maybe here? https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/closure.clj#L1259
@darwin yea I suppose I could, but that would probably get skipped for any :none
optimization builds
I remember having seen a data viewer for clojurescript but I haven't saved it...it is a bit like how cljs-devtools
shows it (with + for expanding).
Do you folks have any suggestion?
i vaguely remember noprompt having one
uhm maybe that was the one...
thanks
ah, for Om
it was made before cljs.pprint was available, would love to see it use better layouting
maybe I will go for pprint for now as string...it is for debug purposes anyways, but thanks @shaunlebron
@darwin I knew you would save my chickens thanks!
java -cp clojurescript-1.9.226.jar:src clojure.main scripts/build.cljs
=> Error: could not find or load main class clojure.main
I haven’t done much, just few patches here and there, I was unable to use clojurescript via leiningen checkouts for some reason, so I had to always do lein install
on every change (to test my patched version agains my project)
@nickt have you read this https://github.com/clojure/clojurescript/wiki/Developers ?
btw. I had a small shell file-watching script which did lein install
on every file save under clojurescript src tree, that made my dev experience a bit less miserable 🙂
@dnolen yes I was following "Building the Compiler" but it didn't mention anything about the uberjar
@dnolen hm.. the output of build
was a jar with which I tried to run java -cp clojurescript-1.9.226.jar:src clojure.main scripts/build.cljs
but I got the error I mentioned above
yes so that Quick Start users don’t have to think about dependency management when just trying ClojureScript out
I might use it for now just to facilitate my hacking. If my hacks yield reason to get more serious about it then I'll probably revisit
@nickt: btw. what are you trying to build? for more serious JS transformation, another consideration could be writing a custom Google Closure compiler pass (if experienced in Java)
you could write a simple file-watching tool converting css -> edn, and then use macros/functions in clojure(script) to do the heavy-lifting work
@dnolen: is the uberjar faster for building somehow?
I used garden library in one of my earlier Om projects, and it is awesome once you have "CSS as data" you can do anything to it and use macros as compile-time preprocessor/optimizer/compiler.
@shaunlebron what do you mean ?
@dnolen: I vaguely remember the quick start method having a faster startup, maybe that’s because it’s skirting lein and doesn’t have anything to do with the uberjar. i thought maybe the uberjar had precompiled some things as well
@shaunlebron oh right, avoiding lein is always gonna be faster
I thought the uberjar might’ve contained a precompiled compiler core as well
I suppose that would mean an analysis cache
@nickt: i think lein spins up at least two jvm instances
@shaunlebron yes that helps too, but we ship an AOTed artifact as well that anyone can take advantage of
@nickt: i can’t remember why, something about running one in the context of your project
ah, aot was the keyword I was looking for
@nickt lein never prioritized speed, and it’s too far along to change any of the fundamental decisions
which isn’t to say you shouldn’t use it, it’s a fine tool - it’s just why I don’t use it
Pertinent to this, there was a discussion about repl speed here: https://github.com/clojure-emacs/cider/issues/1717
How can I rebind a dynamic var in another namespace? This var is used by the function I’m calling but is not referenced from the call location. Was going to try something like this.
(defn post!
[{:keys [url body headers]}]
(with-bindings {#'xhr/*xhr-impl* MyXhrIO}
(p/then (http/send! client {:method :post
:url url
:body (js/JSON.stringify (clj->js body))
:headers (spy headers)})
process-response)))
but with-bindings doesn’t seem to exist in cljs.@kingoftheknoll there are multiple things going on here
I’m only wanting to bind to replace the XhrIo constructor so I can set withCredentials
to true. So nothing should be async at the time.
httpurr. But I’m not even getting to the binding part. Figwheel says with-bindings doesn’t exist and binding gives me errors.
Could be one of those commands leverages an internal thread pool for execution, yeah. E.g. using an agent?
trying to rebind this https://github.com/funcool/httpurr/blob/master/src/httpurr/client/xhr.cljs#L12
@kingoftheknoll “gives me errors” is not useful information
@fellshard we’re compiling to JavaScript so single threaded
@kingoftheknoll OK, so Vars in ClojureScript aren’t really a thing you shouldn’t write stuff like that
I believe the only use case for #’
in cljs is to retrieve metadata for a var at runtime
even then a bit questionable to do in normal code since it dumps line, column, file etc.
@dnolen wow thanks for the clarification! So I should be about to just do something like (aset xhr/*xhr-impl* MyXhrIO)
@kingoftheknoll you may try set!
instead of aset
there
but binding
is probably preferred