This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-03
Channels
- # aleph (1)
- # beginners (42)
- # boot (34)
- # cider (157)
- # cljs-dev (12)
- # cljsrn (3)
- # clojure (165)
- # clojure-conj (1)
- # clojure-india (1)
- # clojure-italy (6)
- # clojure-russia (20)
- # clojure-spec (27)
- # clojure-uk (173)
- # clojurescript (116)
- # cursive (30)
- # datomic (87)
- # devcards (1)
- # docs (9)
- # emacs (2)
- # ethereum (2)
- # events (2)
- # fulcro (60)
- # graphql (10)
- # hoplon (2)
- # jobs-rus (6)
- # keechma (1)
- # lein-figwheel (9)
- # leiningen (36)
- # luminus (2)
- # mount (3)
- # off-topic (16)
- # om (14)
- # onyx (12)
- # pedestal (19)
- # portkey (107)
- # re-frame (9)
- # reagent (5)
- # ring (26)
- # shadow-cljs (149)
- # spacemacs (3)
- # sql (6)
I’m trying to get a project building with shadow-cljs, and running into a problem compiling tools.reader:
failed to compile resource: [:shadow.build.classpath/resource "cljs/tools/reader/reader_types.cljs"]
{:tag :shadow.build.compiler/compile-cljs, :source-id [:shadow.build.classpath/resource "cljs/tools/reader/reader_types.cljs"], :url #object[java.net.URL 0x2be3d771 "jar:file:/Users/MattPro/.m2/repository/org/clojure/tools.reader/1.0.5/tools.reader-1.0.5.jar!/cljs/tools/reader/reader_types.cljs"], :file nil, :line 43, :column 1, :source-excerpt {:start-idx 38, :before [";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" ";; reader deftypes" ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" ""], :line "(deftype StringReader", :after [" [s s-len ^:mutable s-pos]" " Reader" " (read-char [reader]" " (when (> s-len s-pos)" " (let [r (.charAt s s-pos)]"]}}
ExceptionInfo: failed to compile resource: [:shadow.build.classpath/resource "cljs/tools/reader/reader_types.cljs"]
...
Caused by:
ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.lang.String
clojure.core/symbol (core.clj:579)
clojure.core/symbol (core.clj:574)
cljs.analyzer/dep-has-global-exports? (analyzer.cljc:763)
cljs.analyzer/dep-has-global-exports? (analyzer.cljc:759)
@mhuebert very confusing error, not sure how it ends up on that path. it compiles fine for me. might be a case of broken metadata which causes it to report the wrong location. will look into it
just released 2.0.7
which bumps the clj(s) versions, should not affect that error but who knows
tried with 2.0.7 and deleted tools.reader from my repository (to fetch again) and deleted the target folder. same error, but much nicer formatting. agree it is very weird.
File: nil
--------------------------------------------------------------------------------
...
42 |
43 | (deftype StringReader
-------^------------------------------------------------------------------------
44 | [s s-len ^:mutable s-pos]
...
--------------------------------------------------------------------------------
ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.lang.String
clojure.core/symbol (core.clj:579)
clojure.core/symbol (core.clj:574)
cljs.analyzer/dep-has-global-exports? (analyzer.cljc:763)
i believe i require these as clojure.tools.reader (w/o reader conditionals), could the aliasing have anything to do with it?
after switching all the tools.reader requires to reader conditionals, I get a different error, related to “cljs.repl” and ‘Unable to find static field: INFERRED_CONST_CHECKS’, full stacktrace: https://gist.github.com/mhuebert/263433cd01df6053f237d9671c3c6e41
have you tried compiling with a require to `[clojure.tools.reader.reader-types] (instead of cljs.tools.reader)?
what are your :dependencies
? maybe there is an old version of closure in there somehow?
mattpro:editor MattPro$ shadow-cljs clj-repl
shadow-cljs - config: /Users/MattPro/Documents/sites2017/maria/editor/shadow-cljs.edn version: 2.0.7
shadow-cljs - starting ...
WARNING: boolean? already refers to: #'clojure.core/boolean? in namespace: clojure.tools.analyzer.utils, being replaced by: #'clojure.tools.analyzer.utils/boolean?
WARNING: boolean? already refers to: #'clojure.core/boolean? in namespace: clojure.tools.analyzer, being replaced by: #'clojure.tools.analyzer.utils/boolean?
shadow-cljs - server running at
shadow-cljs - socket repl running at localhost:62834
shadow-cljs - nrepl running at localhost/127.0.0.1:62836
shadow-cljs - REPL - see (help), :repl/quit to exit
[1:0]~shadow.user=> (require 'cljs.repl)
CompilerException java.lang.RuntimeException: Unable to find static field: INFERRED_CONST_CHECKS in class com.google.javascript.jscomp.DiagnosticGroups, compiling:(cljs/closure.clj:100:1)
in .lein/profiles.clj
i have [lein-count "1.0.2"] [lein-clojars "0.9.1"] [lein-release "1.0.6"]
[zilence@zpro ~/code/tmp/weird]$ shadow-cljs init
shadow-cljs - init
- /Users/zilence/code/tmp/weird/shadow-cljs.edn
Create? [y/n]: y
shadow-cljs - created default configuration
[zilence@zpro ~/code/tmp/weird]$
[zilence@zpro ~/code/tmp/weird]$ shadow-cljs clj-repl
shadow-cljs - config: /Users/zilence/code/tmp/weird/shadow-cljs.edn version: 2.0.7
shadow-cljs - updating dependencies
Retrieving thheller/shadow-cljs/2.0.7/shadow-cljs-2.0.7.pom from
Retrieving thheller/shadow-cljs/2.0.7/shadow-cljs-2.0.7.jar from
shadow-cljs - dependencies updated
shadow-cljs - re-building aot cache on startup, that will take some time.
shadow-cljs - starting ...
shadow-cljs - server running at
shadow-cljs - socket repl running at localhost:52062
shadow-cljs - nrepl running at localhost/127.0.0.1:52064
shadow-cljs - REPL - see (help), :repl/quit to exit
[1:0]~shadow.user=> (require 'cljs.repl)
nil
[1:0]~shadow.user=>
those boolean? warnings appear on my system no matter what tooling i use, and am unsure of why, even if i comment everything out in .lein/profiles
[maven] org/clojure/clojurescript/1.9.854/clojurescript-1.9.854.jar
how does that get there
ah ok. i had an error with the clojure dependency but not cljs, hence i thought cljs was required
[1:0]~shadow.user=> (require 'cljs.repl)
CompilerException java.lang.RuntimeException: No such var: util/normalize-path, compiling:(cljs/closure.clj:1601:22)
cljs/core.cljs [line 988, col 14] No reader function for tag Inf.
{:type :reader-exception, :ex-kind :reader-error, :file "cljs/core.cljs", :line 988, :col 14}
ExceptionInfo: cljs/core.cljs [line 988, col 14] No reader function for tag Inf.
ok the problem is that shadow-cljs
already depends on those things but if you declare them in :dependencies
they overwrite the version that shadow-cljs
wants
so shadow-cljs will ignore the project.clj in the current directory but still use the deps listed in the dependencies
Not sure what you mean? it uses the same lib that lein
uses to resolve dependencies, so the same rules apply
i mean somewhere in a transitive dependency of my project, an old version of tools.reader is included, [maven] org/clojure/tools.reader/1.0.3/tools.reader-1.0.3.jar
it shows up when i run --cli-info and I am guessing that’s why i am still getting the Inf error
i have a bunch of local libs unfortunately which might make that complicated because i’ve been makign changes to them during this debugging process so there are a bunch of undeployed snapshots
is there a way to see a tree of dependencies / see where a particular dep is coming from?
easy fix would be to just add [org.clojure/tools.reader "1.1.0"]
to your deps (I think)
btw libraries should always use [org.clojure/clojurescript "1.9.854" :scope :provided]
I’m regretting a bit that I relaxed the AOT compiler to only recompile when the shadow-cljs version changes
it was whenever deps changed but it doesn’t really need to re-compile AOT when you change the version of a CLJS lib
i like how fast shadow-cljs usually give me feedback. more errors, earlier, than other tools i’ve used
ok, it is building, just a warning from transit
------ WARNING #1 --------------------------------------------------------------
File: :332:1
--------------------------------------------------------------------------------
328 | "Construct a URI from a string."
329 | [s]
330 | (ty/uri s))
331 |
332 | (defn uri?
-------^------------------------------------------------------------------------
uri? already refers to: cljs.core/uri? being replaced by: cognitect.transit/uri?
--------------------------------------------------------------------------------
333 | "Returns true if x is a transit URI value, false otherwise."
334 | [x]
335 | (ty/isURI x))
336 |
337 | (defn uuid
--------------------------------------------------------------------------------
https://www.maria.cloud, an editor environment
so in the existing (non-shadow) build, window.cljs.core$macros is there, missing here
(ns cljs.js
(:refer-clojure :exclude [require])
(:require-macros [cljs.js :refer [dump-core]]
[cljs.env.macros :as env])
(:require [clojure.string :as string]
[clojure.walk :as walk]
[cljs.env :as env]
[cljs.spec.alpha]
[cljs.analyzer :as ana]
[cljs.compiler :as comp]
[cljs.tools.reader :as r]
[cljs.tools.reader.reader-types :as rt]
[cljs.tagged-literals :as tags]
[goog.crypt.base64 :as base64]
[cljs.source-map :as sm])
(:import [goog.string StringBuffer]))
(js/goog.require "cljs.core$macros")
last time I talked to dnolen about this he said that core$macros are handled as a special case, other macro files are not compiled, you have to provide them manually (which is a big PITA)
still trying to figure out where exactly it gets compiled, there a whole lot of special cases for cljs.core$macros
yeah! that would be nice. there is the jira issue: https://dev.clojure.org/jira/browse/CLJS-2270
Not enough time but I will look into it later today https://github.com/thheller/shadow-cljs/issues/103
ok. i realize this may be a messy thing. if we can get it working i would be very happy to use shadow-cljs for all of Maria’s builds, i really prefer it in the small cases i’ve tried
I definitely want to support this use case. It just scares me since I don’t really understand how self host works 🙂
if I figure out how to compile cljs.core it should be easy to extend it to others as well
Feedback from my tests, definitively shadow is nice for node + electron... perhaps doc 😉 need help ?
I looked on the lumo integration as repl, seems tedious. I have to look more on the whole ecosystem... coming from clojure.... 😉
But I have to put it on wheels with boot and lein. Big problems with boot pods that wipe the whole directory, hard to put your main.js in root of the project... well, not hard, but you loose the whole thing after compile 😄
@ivanpierre there has been some discussion about lumo repl integration in the lumo
channel...I am very fond of the Language Server Protocol for that also seeing it is now supported everywhere but I haven't got around to doing it