This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-04
Channels
- # aleph (24)
- # beginners (60)
- # cider (20)
- # clara (4)
- # cljs-dev (13)
- # cljsrn (4)
- # clojure (66)
- # clojure-italy (32)
- # clojure-nl (4)
- # clojure-serbia (1)
- # clojure-uk (207)
- # clojurescript (115)
- # cursive (3)
- # datomic (36)
- # defnpodcast (1)
- # duct (15)
- # fulcro (14)
- # graphql (8)
- # lein-figwheel (1)
- # leiningen (4)
- # off-topic (140)
- # pedestal (40)
- # portkey (3)
- # reagent (40)
- # remote-jobs (1)
- # ring (11)
- # shadow-cljs (31)
- # spacemacs (6)
- # sql (65)
- # tools-deps (67)
- # yada (1)
there’s something that takes (.-foo-bar! obj)
and turns -foo-bar!
into "foo_bar_BANG_"
Yup thats what he needed!
Bruce, you're the bomb, thanks for Figwheel. I was hoping for something more substantive 🙂
@benisrood Try figwheel-main you will like it, i just switched yesterday https://github.com/bhauman/lein-figwheel/tree/master/figwheel-main
https://clojurescript.org/reference/repl-and-main ( ← ref doc I was after )
C-c always works.
😂:rolling_on_the_floor_laughing:
@bhauman just switched to clj+figwheel.main (from lein figwheel), works well for me!
one question, does this give you automatic caching of cljs compiler results?
@pesterhazy You can have a target directory to output the results by specifying :paths ["target"]
@metacritical so if I add the paths key, code is automatically cached? Where does the key go?
deps.edn if you use clojure cli tools , in case you use lein
https://github.com/bhauman/lein-figwheel/tree/master/figwheel-main
Transit sits on top of json and encodes/decodes clj data types.
@manutter51thanks
I upgraded to new version of clojure and clojurescript and when I run lein with-profile test doo chrome-headless test
I get this error
Caused by: java.lang.ClassNotFoundException: com.google.javascript.jscomp.ProcessEs6Modules
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
Here are my dependencies
:dependencies [[org.clojure/clojure "1.9.0"]
[org.clojure/clojurescript "1.10.238"]
[org.clojure/clojurescript "1.10.238" :exclusions [[cljsjs/react-with-addons] [cljsjs/create-react-class] [cljsjs/react-dom-server] [cljsjs/react-dom] [cljsjs/react]]]
[com.cognitect/transit-clj "0.8.300" :exclusions [[org.clojure/clojure]]]
[com.cognitect/transit-java "0.8.324"]
[com.fasterxml.jackson.core/jackson-core "2.8.7"]
[commons-codec "1.10"]
[org.msgpack/msgpack "0.6.12"]
[com.googlecode.json-simple/json-simple "1.1.1" :exclusions [[junit]]]
[org.javassist/javassist "3.18.1-GA"]
[com.google.javascript/closure-compiler-unshaded "v20180204"]
[args4j "2.33"]
[com.google.code.findbugs/jsr305 "3.0.1"]
[com.google.code.gson/gson "2.7"]
[com.google.errorprone/error_prone_annotations "2.0.18"]
[com.google.guava/guava "22.0"]
[com.google.j2objc/j2objc-annotations "1.1"]
[org.codehaus.mojo/animal-sniffer-annotations "1.14"]
[com.google.javascript/closure-compiler-externs "v20180204"]
[com.google.jsinterop/jsinterop-annotations "1.0.0"]
[com.google.protobuf/protobuf-java "3.0.2"]
[org.clojure/data.json "0.2.6"]
[org.clojure/google-closure-library "0.0-20170809-b9c14c6b"]
[org.clojure/google-closure-library-third-party "0.0-20170809-b9c14c6b"]
`@dnolen [com.google.javascript/closure-compiler-unshaded "v20180204"]
are you referring to this
Robins-MacBook-Pro-3: rnagpal$ lein deps :why "com.google.javascript/closure-compiler-unshaded"
[org.clojure/clojurescript 1.10.238]
[com.google.javascript/closure-compiler-unshaded v20180204]
try lein deps :tree
to inspect the jars that you're pulling in
@pesterhazy did you resolve your question?
@bhauman I don't think so, I was wondering whether compilation caching is enabled by default with figwheel.main
I'm using it as described in the readme
{:deps {org.clojure/clojurescript {:mvn/version "1.10.238"}
reagent {:mvn/version "0.7.0"}
data-frisk-reagent {:mvn/version "0.4.5"}
com.bhauman/figwheel-main {:mvn/version "0.1.0-SNAPSHOT"}
com.bhauman/rebel-readline-cljs {:mvn/version "0.1.3"}}
:paths ["src" "target" "resources"]}
and then clojure -m figwheel.main -b dev -r
basically if you have a stable target directory and build id i.e. "dev" you are going to get incremental compiles
awesome
so even if I restart figwheel.main, it will still reuse pervious compiler output?
So far using figwheel.main has been smooth! The only thing I didn't figure out immediately was, when I started using my own index.html, to know what script tag url I had to add. It turned out to be <script src="cljs-out/dev-main.js"></script>
@bhauman
@pesterhazy yes I'm wanting to make that more apparent, I got bogged down by try to provide a definitive answer for that given all the different configurations available
I didn't realize it would include the build-id in the filename
have you tried the -pc
arg? its pretty darn helpful when your about curious whats going on
yeah, it's helpful
I was confused for a bit because clojure -m figwheel.main -b dev -pc -r
didn't work (you need to move -pc
before -b dev
)
I understand. It's just that people aren't used to the order of positional arguments mattering
I also remember that Rich Hickey argues against positional fn parameters, and in favor of keyword args 🙂
I'm not serious, I know it's not a figwheel.main issue
@pesterhazy btw I got testing in cljs working pretty quickly with figwheel.main
testing as in running unit tests?
the blue banner of death
pretty cool
it needs some more work, the --main method needs to support async, and it needs to be able to signal exit(1) for CI platforms, and figwheel.main needs to support chrome-headless
I have two projects
1) Styles + Basic components
2) Complex components
I want to copy less files as it is from 1 to 2
I have a lein plugin that copies the files from with jar to the project
So I want the less files to be copied to the jar. They solution which I found for this is to use resource-paths
. But if I mention less
in resource paths its copies it as exploded
Was able to do it with https://github.com/m0smith/lein-resource plugin
So I copied a regex from some javascript code, and it doesn't work in ClojureScript, because it has an escaped /
.
(re-find #"\/" "/")
This works in Clojure, but in ClojureScript the \
gets double escaped.
ClojureScript 1.10.238
cljs.user=> (re-find #"\/" "/")
repl:1
(function (){try{return cljs.core.pr_str((function (){var ret__6387__auto__ = cljs.core.re_find.call(null,/\\//,"/");
^
`cljs.user=> (.toString (fn [] (re-find #“/” “/”))) “function (){\nreturn cljs.core.re_find.call(null,/\\//,\“/\“);\n}“`
`cljs.user=> (re-find #“\/” “/”) SyntaxError: Unexpected token , (<NO_SOURCE_FILE>) clojure$browser$repl$evaluate_javascript (clojure/browser/repl.cljs:118:4) ...`
What's different about it?
cljs.user=> (.toString (fn [] (re-find #"\/" "/")))
repl:2
return cljs.core.re_find.call(null,/\\//,"/");
^
SyntaxError: Unexpected token ,
at new Script (vm.js:51:7)
at createScript (vm.js:136:10)
at Object.runInThisContext (vm.js:197:10)
at Domain.<anonymous> ([stdin]:76:38)
at Domain.run (domain.js:323:14)
at Socket.<anonymous> ([stdin]:73:29)
at Socket.emit (events.js:180:13)
at Socket.emit (domain.js:422:20)
at addChunk (_stream_readable.js:274:12)
at readableAddChunk (_stream_readable.js:257:13)
several problems: 1) it looks to me that your repl swallowed the syntax error, 2) the javascript code you presented was also generated from #“/” and that looks correct to me
#"/"
is fine; #"\/"
isn't.
Ok, so it's not different on mac?
ah, now when I’m looking at your snippet you posted, there is a syntax error, see the hanging ^
there
it behaves the same, only from your post it wasn’t obvious, I thought it just generated /\\//
:thumbsup:
The issue is that \
is getting escaped to \\
, so the /
isn't escaped which ends the regex.
Oh... Sorry, I'm following now.
in the broken case of #“\/” we are probably dealing with some hidden characters, that is confusing us
not sure what cljs compiler generated there, but would be worth looking at physically generated file and its characters I guess
Yeah, I'm having trouble following the second regex. :man-shrugging: Oh well; it's an easy workaround. I just figured I'd report it.
wait, now when I’m looking at it again, my examples are busted, the .toString is showing a string which contains another layer of escaping
How do you?
Nice, thanks
ok, now it shows `cljs.user=> (fn [] (re-find #“/” “/”)) #object[ret__6387__auto__ “function (){ return cljs.core.re_find.call(null,/\//,“/”); }“]`
so I take back my words, you were correct, \ gets emitted into js regex as is and causes unwanted escape of the following character
Oh, right; I was thinking it was the other way around. I thought the \
got escaped, but the /
didn't.
Alright, it's an issue with the Clojure compiler using java.util.regex.Pattern
to get the pattern.
(re-find #"\/" "/")
works fine in self-hosted cljs.
This isn't a big deal, because the /
doesn't need to be escaped, but I assume this kind of thing shouldn't happen.