This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-27
Channels
- # bangalore-clj (2)
- # beginners (41)
- # cider (14)
- # cljs-dev (12)
- # cljsrn (2)
- # clojure (106)
- # clojure-austin (6)
- # clojure-dev (22)
- # clojure-dusseldorf (1)
- # clojure-france (1)
- # clojure-greece (17)
- # clojure-italy (6)
- # clojure-poland (3)
- # clojure-russia (10)
- # clojure-serbia (5)
- # clojure-spec (24)
- # clojure-uk (100)
- # clojurescript (126)
- # cursive (3)
- # data-science (5)
- # datascript (15)
- # datomic (3)
- # defnpodcast (2)
- # dirac (6)
- # emacs (10)
- # fulcro (121)
- # graphql (30)
- # hoplon (7)
- # jobs (2)
- # leiningen (20)
- # off-topic (14)
- # onyx (3)
- # other-languages (13)
- # pedestal (1)
- # perun (2)
- # planck (41)
- # re-frame (16)
- # reagent (6)
- # reitit (5)
- # remote-jobs (3)
- # ring (1)
- # ring-swagger (17)
- # shadow-cljs (137)
- # spacemacs (6)
- # sql (4)
- # uncomplicate (7)
- # unrepl (56)
- # vim (27)
Hi. I've been using shadow-cljs for a new project, and it seems to be working well. However, I've run into a wall trying to get spec-tools library added a a dependency. When I start up shadow-cljs with spec-tools added as a dependency, I get the following error:
failed to inspect cljs file: jar:file:/home/matthys/.m2/repository/metosin/spec-tools/0.5.1/spec-tools-0.5.1.jar!/spec_tools/core.cljc {:tag :shadow.build.classpath/inspect-cljs, :resource-name "spec_tools/core.cljc", :url #object[java.net.URL 0x7f2d31af "jar:file:/home/matthys/.m2/repository/metosin/spec-tools/0.5.1/spec-tools-0.5.1.jar!/spec_tools/core.cljc"]}
Has anyone seen a similar error before?This is then followed by the following exception:
failed to parse ns form {:clojure.spec.alpha/problems ({:path [:clauses :refer-clojure :clause], :pred #{:refer-clojure}
@mjmeintjes fixed in [email protected]
. my ns
parser was a bit too strict and didn’t allow (:import)
which spec-tools.impl
has for :cljs
Is this supported in shadow-cljs: js/document.body
to get the document body? Because I am trying to use a preload for fulcro-devtools and here: https://github.com/fulcrologic/fulcro-inspect/blob/develop/src/fulcro/inspect/ui/events.cljs#L79 target is undefined
@thheller Should i be using package.json or :npm-deps
for listing and managing js dependencies?
I’ve been using package.json, but recently noticed that if I require CLJS-lib A (built with shadow) that uses package.json for js deps within CLJS-lib B (also shadow-built), I won’t get CLJS-lib A’s js dependencies
@mitchelkuijpers yes of course thats supported.
@colindresj libraries should declare :npm-deps
in a deps.cljs
file that will make shadow-cljs
isntall them on startup
Thanks @thheller. So, sort of like foreign libs were specified, except obviously replacing :foreign-libs
for :npm-deps
What’s the mapping look like within :npm-deps
? is it module name to semnatic versioning range?
Cool thank you
@thheller I have some problem with js/requestAnimationFrame
.
I check the output of (or batched-updates js/requestAnimationFrame)
, it's
return or__32840__auto__;
} else {
requestAnimationFrame;
}
figwheel outputs:
if(cljs.core.truth_(or__30096__auto__)){
return or__30096__auto__;
} else {
return requestAnimationFrame;
}
If I changed the output of shadow-cljs to figwheel output, then it doesn't complain.
The error is something like: Uncaught TypeError: Cannot read property 'cljs$core$IFn$_invoke$arity$1' of undefined at Object.citrus$reconciler$schedule_update_BANG_ [as schedule_update_BANG_]
var G__54995_54997 = "or";
var G__54996_54998 = (function (){var or__34403__auto__ = null;
if(cljs.core.truth_(or__34403__auto__)){
return or__34403__auto__;
} else {
document.body}
})();
console.log(G__54995_54997,G__54996_54998);
yeah exactly!
Currently I can work around it by wrapping a function:
(or batched-updates (fn [] js/requestAnimationFrame))
which works for me.
so quick!
:thumbsup:
@tiensonqin @mitchelkuijpers fixed in [email protected]
. sorry about that.
Thank you very much for your great effort!
I'll try it soon and report back.
Cool! Thnx
@thheller confirmed it works, thanks.
-> Closure - Checking ...
ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.String
shadow.build.closure/closure-source-file (closure.clj:565)
shadow.build.closure/closure-source-file (closure.clj:565)
shadow.build.closure/source-map-sources/fn--21021 (closure.clj:930)
wanting to run it to find a problem with the aero
lib on nodejs, in advanced opt mode it gives:
function jB(a,b,c){b=b.l?b.l():b.call(null);$f.c(c,Qd,a);return b}function kB(a,b,c){b=null!=b&&(b.o&64||p===)?pf(ni,b):b;var d=E.b(b,Sk),e=E.b(b,Ck),f=E.b(b,Nk);if(v(Zl.a(f)))return null;try{var g=jB(a,d,c)}catch(k){throw c=k,[x.a(["could not start [",x.a(a),"] due to"].join(""))," ",x.a(c)].join("");}hB(b,g);$f.D(fB,T,a,new u(null,1,[Ck,e],null));return iB(new X(null,2,5,Y,[a,Nk],null),new vi(null,new u(null,1,[Zl,null],null),null))}
^
could not start [#'permafrost.config/config] due to TypeError: Cannot read property 'b' of undefined
-> Closure - Optimizing ...
ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.String
shadow.build.closure/closure-source-file (closure.clj:565)
shadow.build.closure/closure-source-file (closure.clj:565)
shadow.build.closure/source-map-sources/fn--21022 (closure.clj:930)
:builds
{:pf {:target :node-library
:output-to "out/permafrost.js"
:exports {:main permafrost.cli/main}
:devtools {:before-load permafrost.cli/stop!
:after-load permafrost.cli/start!}
:release {:output-to "permafrost.js"
:compiler-options {:infer-externs :auto
:optimizations :advanced}}}}}
I’ve narrowed it down to be in the aero
library (i.e. if i exclude the aero/read-config
call doesn’t trigger). but was hoping for a bit more info to figure out where it is.
ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.String
should be fixed in [email protected]
not sure what aero
has to do with it though. release source maps were just generally broken for :node-library
yeah - i’m just hoping that i’ll get a bit more info out with that fix, letting me find the issue in aero
/Users/sundbp/dev/bi/permafrost/permafrost.js:20075
throw $done$jscomp$9_t__38328__auto__$jscomp$inline_1326$$ = $e38700$jscomp$inline_1327$$, [$cljs$core$str$$.$cljs$core$IFn$_invoke$arity$1$(["could not start [", $cljs$core$str$$.$cljs$core$IFn$_invoke$arity$1$($state$jscomp$22$$), "] due to"].join("")), " ", $cljs$core$str$$.$cljs$core$IFn$_invoke$arity$1$($done$jscomp$9_t__38328__auto__$jscomp$inline_1326$$)].join("");
^
could not start [#'permafrost.config/config] due to TypeError: Cannot read property '$cljs$core$IFn$_invoke$arity$2$' of undefined
throw $done$jscomp$9_t__38328__auto__$jscomp$inline_1326$$ = $e38700$jscomp$inline_1327$$,
that the heck is that? 😛
yeah, but in this case i think they wrote it for lumo, and that’s probably not gonna fly
i’m cleaning up aero and that’ll probaly be it + I learnt a bit about the process while doing it.
aero scares me a bit because of https://github.com/juxt/aero/blob/master/src/aero/vendor/dependency/v0v2v0/com/stuartsierra/dependency.cljc
btw, in this case i have a bin/runner.js, like your shadow-clj package. would that in any way throw source-maps off?
btw you can also add <project>/externs/pf.txt
and just put the problematic things into it. so
hostname
writeFileSync
@thheller really enjoying shadow-cljs so far, great work! Scrolling up in the channel, it seems like deps.cljs
has to have the same information that already resides in the package.json
file. Is there an easier way to keep the two in sync?
check output
------ WARNING #3 --------------------------------------------------------------
File: /Users/zilence/code/shadow-cljs/src/dev/demo/lib.cljs:13
--------------------------------------------------------------------------------
10 |
11 |
12 | (def fs (js/require "fs"))
13 | (fs.writeFileSync "x" "foo" "utf-8")
--------------------------------------------------------------------------------
Property writeFileSync never defined on demo.lib.fs
--------------------------------------------------------------------------------
14 |
--------------------------------------------------------------------------------
the project always uses package.json
(since that drives npm
which isn’t aware of :npm-deps
)
It would be cool if package.json
served as the canonical, and shadow-cljs could generate deps.cljs
from it. It seems like it could be potentially dangerous for packages to get out of sync if writing a lib (also another thing to remember).
agreed. I have not yet done any work related to publishing libs with shadow-cljs, deps.cljs
would be part of it.
@thheller ah, that’s good to know. I made PRs for the 2 libs I used that didn’t play ball, but good to know one can use official releases with externs while they await merge+release.
so far i’ve used: package.json has all node dependencies, nothing in deps.cljs/shadow-cljs.edn. shadow-cljs.edn has all cljs/clj dependencies. has been working ok sofar.
yeah if I want publishing I need to mess with :profiles
and such. I really don’t want to do that.
but it needs a proper way to exclude some dev-only code from a lib .jar
. same as lein
/`boot`
@sundbp we’re working with publishing this as a library that will be brought in from other cljs projects, so we need dependencies declared in the deps.cljs
file
@koz be careful when publishing libraries with :npm-deps
though. pretty good odds they won’t work with anything but shadow-cljs
@thheller it’d be awesome if source-maps for nodejs was to work - give me a shout if you think you know what’s wrong and there’s anything I can do to help. thanks!