This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-19
Channels
- # announcements (4)
- # asami (1)
- # babashka (48)
- # beginners (84)
- # bristol-clojurians (1)
- # calva (15)
- # chlorine-clover (11)
- # cider (37)
- # clj-kondo (17)
- # clojure (72)
- # clojure-europe (13)
- # clojure-italy (43)
- # clojure-nl (6)
- # clojure-spec (8)
- # clojure-uk (19)
- # clojuredesign-podcast (7)
- # clojurescript (132)
- # code-reviews (7)
- # conjure (3)
- # cursive (24)
- # datascript (10)
- # datomic (61)
- # docker (4)
- # duct (24)
- # emacs (2)
- # figwheel-main (8)
- # fulcro (43)
- # graalvm (5)
- # juxt (1)
- # keechma (14)
- # malli (2)
- # off-topic (120)
- # re-frame (111)
- # reagent (6)
- # reitit (13)
- # shadow-cljs (118)
- # spacemacs (3)
- # tools-deps (32)
- # uncomplicate (5)
- # xtdb (6)
Thanks @dpsutton!
(doesn't seem to help π π )
It looks like browser caching was at least part of the problem, since on different browsers I got different behaviors. Now I cannot reproduce it, and everything seems to be fine. :thinking_face:
@daslu :resouce-paths
in not a thing in shadow-cljs.edn
and wouldn't apply anyways since you have :lein true
and all classpath management is done by project.clj
. setting :optimizations
in :dev
only does absolutely nothing since :dev
ALWAYS forces :none
and that cannot be modified. you can also leave :devtools
always in since it will be ignored in release
builds.
you should really consider bundling you CSS properly. putting a bunch of paths into :dev-http
like that is not going to end well π
FWIW watch
and compile
differ in that watch
injects a bunch of extra REPL/hot-reloaded extra code, otherwise they should be the same
@thheller thank you so much for this kind and detailed mentoring. This is really enlightening and helps so much. β€οΈ
ah and also only use :dev-http
since it will conflict with :devtools {:http-port ..}
otherwise
{:lein true
:dev-http {8080 ["resources/public/"
"target"
"classpath:resources"
"classpath:resources/public"
"node_modules"
"node_modules/leaflet/dist"
"node_modules/mathjax/es5"
"node_modules/ag-grid-community"]}
:builds {:app {:output-dir "resources/public/js/compiled"
:asset-path "/js/compiled"
:target :browser
:modules {:main {:init-fn gorilla-notes.main/main!}}
:devtools {:after-load gorilla-notes.main/reload!}}}}
The :bootstrap
target seems to be undocumented, and the anchor https://shadow-cljs.github.io/docs/UsersGuide.html#target-bootstrap (used by the very first mention of :bootstrap
in the user's guide) is not attached to anything.
Is it an intentional omission?
hey all! @mhuebert, question for you if you have a moment...
hi @sritchie09! it does look like encore may be the issue here β in the source https://github.com/ptaoussanis/encore/tree/master/src/taoensso I see cljx files... is there another version somewhere ported to use cljc?
@mhuebert I don't think he has one, but of course I could fork it, or exclude. I will say that I went into the jar when debugging and deleted the cljx file, leaving only the generated cljs
and clj
files
and this same behavior still occurred
I can definitely try swapping that dependency and seeing if we have any luck, I'm only pulling it in transitively to do logging
I can exclude it with a little work by replacing the logging calls in sicmutils
subtle tricks are often needed for selfhost compatible macros, see https://github.com/cgrand/macrovich
yes, I expect I'm going to have to do this too for sicmutils
which is totally fine! I've been aiming at Maria for a few weeks, and I'm so close...
let me try again, but compilation does fail, I believe
If encore
is indeed not compatible with bootstrapped CLJS, maybe it's worth creating an issue in its repo.
okay, that triggers The required namespace "taoensso.encore" is not available, it was required by "taoensso/timbre.cljs".
agree that this merits an issue in their repo
I'm trying to get Maria working with https://github.com/littleredcomputer/sicmutils, so we can do physics, calculus etc in Maria
I'm hitting an issue that I've nailed down to something strange in the bootstrap build
hence @p-himikβs Q
basically, if I use this entry in shadow-cljs.edn
, as the project currently uses:
:bootstrap
{:target :bootstrap
:output-dir "public/js/compiled/bootstrap"
:module-hash-names true
:entries [maria.user]
:exclude [cljs.js]}
then live evaluation in Maria works great! but the build breaks with this error:
[:bootstrap] Build failure:
The required namespace "" is not available, it was required by "taoensso/encore$macros.cljc".
"clojure/java/io.clj" was found on the classpath. Maybe this library only supports CLJ?
+ /live.html
if I change the entries line to this:
:modules {:main {:entries [maria.user]}}
then the build can successfully complete...
but I see this when I try to evaluate anything
this reproduces on the sritchie/last_attempt
branch here: https://github.com/sritchie/maria/tree/sritchie/last_attempt
does anyone with knowledge of :bootstrap
have any thoughts about what's going on, and why this bare :entries
form is both required, but seems to get in the way of cljs compilation?
in the shadow-bootstrap-example I see the same thing: https://github.com/mhuebert/shadow-bootstrap-example/blob/master/shadow-cljs.edn#L10
@sritchie09 :target :bootstrap
does not support :modules
so using it breaks stuff. :module-hash-names
also has no effect. you just specify :entries
and it will compile those to be available in self-hosted
all bootstrap relating things are severly lacking in documentation. mostly because I don't know how half the stuff works either and nobody else bothered to write anything.
@thheller I'm taking a pass at swapping out the logging library -
it's not that important, and might bebest
excluding failed on me, unfortunately
oh, sorry, annoying lack of info
timbre
requires it,
the logging library I was using, so excluding it caused a "encore not found" error
I've got a physics library converted to cljs, and I'm trying to make it available in the Maria environment
which runs in self-hosted mode
this MIGHT be the only issue... but probably there will be some macro problems inside the library
not a big deal to convert to another logging library, of course
well the self-hosted variant is only needed if you actually compile something client side that uses it
strangely, all I was trying to do was require sicmutils.env
, which depends on namespaces that depend on timbre
okay, interesting, maybe this is deeper than we think
[:bootstrap] Build failure:
The required namespace "" is not available, it was required by "taoensso/encore$macros.cljc".
"clojure/java/io.clj" was found on the classpath. Maybe this library only supports CLJ?
+ /live.html
this problem occurred on build
not on any eval -
sending the exclude error
wait a second, I may have misunderstood a suggestion -
I was excluding from the actual jar... I"m trying to add that ns to exclude
now.
sorry about that! yes, I had excluded the transitive encore dep in `deps.edn
this is promising, I see The required namespace "io.aviso.exception" is not available, it was required by "taoensso/timbre$macros.cljc".
yup, chasing it down
we may a winner...
okay, boom, I think we have more errors, but that may get me past that one
okay, amazing, I think we're in business!!!
question for you both...
let's say I do have a macro that I want to use in Maria
#?(:clj
(defmacro bootstrap-repl!
"Bootstraps a repl or Clojure namespace by requiring all public vars from
sicmutils.env. From (This will only work at a repl in Clojurescript.)"
[]
`(require '~['sicmutils.env
:refer
(into [] (keys (ns-publics 'sicmutils.env)))])))
this is probably a case where I need to use macrovich?
or perhaps just specifically refer this macro vs [sicmutils.env :as e :include-macros true]
YES! you're both geniuses, scholars, athletes, whatever you want to be
The lagrangian for a pendulum, it's alive
yup, I just inserted a monster require block
the only thing remaining is that the repl can't see any macros from env
#?(:clj
(defmacro with-literal-functions
[& args]
`(f/with-literal-functions ~@args)))
@thheller it does look like I can access other macros here...
obh, obviously, gotta strip the :clj:
self-host macros is where my understanding of all of this ends. its weird and scary π
I wade into the unknown
holy mackerel...
for anyone curious, what this means is that we can now run all code and exercises from "Structure and Interpretation of Classical Mechanics" live in a browser, via Maria https://www.amazon.com/Structure-Interpretation-Classical-Mechanics-Sussman/dp/0262194554
Sussman wrote another book called Functional Differential Geometry, that implements all of the math of general relativity... all of that works too. The reason for this port is that I want to add the ability to take those equations above, and live-generate an animation, right when you evaluate the code... and have it update when you change things
2020-07-01 21.20.35.gif
you can write down a "lagrangian" that describes this system, but it's a bit frustrating to not get to see it work. so now with cljs we'll be able to!
looks like black magic to me. math and physics are even scarier than self-host macros π
haha, I hear you and agree
that's the problem I'm trying to solve, making it less like black magic and more like a strange game engine (powering the Universe Game that we're all playing)
animation, math, code next to each other. pin function inputs to sliders, and watch everything change in sync, Bret Victor style... http://worrydream.com/#!/Tangle
okay, thanks again, all
@sritchie09 that is wonderful!