BTW, I suspect there's a problem using the cache (-K) when code includes RE literals. I'd have the code work fine once, then fail with:
No such namespace: fs, could not locate fs.cljs, fs.cljc, or JavaScript source providing "fs"
(new)
Function.cljs.core.ex_info.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:1923:72)
Function.cljs.analyzer.error.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:2555:92)
Function.cljs.analyzer.error.cljs$core$IFn$_invoke$arity$2 (NO_SOURCE_FILE <embedded>:2554:92)
(NO_SOURCE_FILE <embedded>:5553:162)
Object.lumo.repl.load_other (NO_SOURCE_FILE <embedded>:6351:378)
lumo.repl.load (NO_SOURCE_FILE <embedded>:6355:96)
Function.cljs.js.require.cljs$core$IFn$_invoke$arity$5 (NO_SOURCE_FILE <embedded>:5555:77)
(NO_SOURCE_FILE <embedded>:5529:284)
Object.cljs.js.run_async_BANG_ (NO_SOURCE_FILE <embedded>:5529:38)
Remove the cache, or removing the -K flag, makes things work properly.@hlship not about regexes, that’s fixed in master
you can alias and refer too
(require '[child_process :refer [execSync]])
Can you do that from :require of ns
?
Yes.
yeah
@hlship feel free to ping me here, I don’t always see messages if not pinged
just released a new version of calvin-cljs
that has multiple fixes including some by @richiardiandrea and @plexus, thanks all for the contributions
find it at: https://www.npmjs.com/package/calvin-cljs
I think I have figured out how to access node libraries from cljs code running in lumo, but haven't yet figured out how to use clojurescript libraries packaged as jars, e.g. on clojars. Do I need to make a project.clj file and do lein deps? Do I need to then also need to create a package.json and do something with npm in order to resolve node dependencies?
@gschiltz a project.clj
and lein deps is a good start
then just run lumo it with
$ lein classpath > cp.txt
$ lumo -c `cat cp.txt` myscript.cljs
Thanks. I'll give it a try.
That got me part way. The case I'm looking at is how to use the tubax XML library, which is available on clojars. I put a dependency to tubax in my project.clj, did the lein classpath, then invoked lumo -c cat cp.txt
to get a REPL. If I do a (require 'tubax.core), I get errors about needing sax. Apparently tubax uses a node module called sax, so I did a "npm install sax", which installed sax in the node_modules directory. I then repeated the above steps, but get the same results. Any ideas? By the way, the project.clj I created just is the following: (defproject tubax-test "0.1.0-SNAPSHOT" :dependencies [[org.clojure/clojure "1.8.0"] [funcool/tubax "0.2.0"]])
@gschiltz found your issue
(require 'v8)
(v8/setFlagsFromString "--nouse_strict")
^ run this before requiring that library
tracking issue: https://github.com/anmonteiro/lumo/issues/225