This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-10
Channels
- # adventofcode (54)
- # announcements (30)
- # asami (13)
- # aws (10)
- # babashka (16)
- # babashka-sci-dev (44)
- # beginners (95)
- # calva (63)
- # clara (10)
- # clj-kondo (3)
- # cljfx (6)
- # cljs-dev (7)
- # cljsrn (1)
- # clojure (68)
- # clojure-europe (59)
- # clojure-nl (7)
- # clojure-norway (12)
- # clojure-spec (6)
- # clojure-uk (6)
- # clojurescript (4)
- # component (4)
- # conjure (5)
- # datomic (3)
- # deps-new (1)
- # events (4)
- # exercism (1)
- # figwheel-main (1)
- # fulcro (33)
- # gratitude (1)
- # improve-getting-started (3)
- # jobs (3)
- # lsp (5)
- # malli (10)
- # membrane (5)
- # music (3)
- # nextjournal (6)
- # off-topic (42)
- # pedestal (2)
- # polylith (14)
- # portal (11)
- # re-frame (42)
- # releases (3)
- # reveal (4)
- # shadow-cljs (62)
- # tools-build (1)
- # tools-deps (3)
- # web-security (1)
- # xtdb (3)
@metasoarous me and @djblue have been fighting with the same usecase for portal. his https://github.com/djblue/portal/pull/87, using sci, seems to work pretty well in my initial tests.
@domagala.lukas Yes; Thanks for the suggestion. SCI is at the very least my backup plan.
Just trying to get a sense of what's possible right now.
The simplicity of SCI for this is very appealing, but there are potentially good reasons to want to use traditional cljs.
I was thinking about this though, and we're really just talking about the live-view here (Oz can both: a) compile md/clj/etc to static html files, b) send a live-view of these files to a browser pane as you edit, for a kind of static live code reloading). Since presumably the live-view will mostly be accessed from the same machine that is serving it, there may not be as much of a need for advanced compilation. So maybe it's fine to leave the live-view app target just whitespace optimized, so that we can more easily extend the base app?
@metasoarous one nice thing about sci is that it can extend an advanced compiled build. We're doing this in nextjournal and Clerk and it gets you both: best performance for the paths that are compiled with the ability to extend it and call into those compiled functions later.
What!? How does it do that?
Once again, @borkdude is blowing my mind over here.
thats not entirely accurate I would say. you still cannot extend SCI from a secondary build. you can only extend SCI from the build that includes SCI itself?
please note that when code size is not a concern at all going with :simple
might be a viable option (or even :none
)
yes @thheller that's correct but you can put sci into a module and lazy load it only when you need it, then the bundle size effect should be negligible if you don't load it?
@metasoarous this works because sci is just a Clojure script program that can be advanced compiled with the rest of your code
I continue to realize things in relation to sci that astound me, yet which in retrospect are entirely obvious
yeah of course. Just commenting with regards to the initial questions wanting snippets of code interacting with live-view after a separate compile
this is still somewhat of a holy grail I've been thinking about quite a lot but there is just no possible way to do this with :advanced
but I usually very much care about build size so :simple
is usually out of the question. for oz/portal/clerk that might not be of such a high concern
That makes; Thank you both!
I continue to realize things in relation to sci that astound me, yet which in retrospect are entirely obvious
yeah being able to use cljs just like clj files would be great for library users and would make sharing a lot easier. sadly even a :none compilation makes it difficult. and even if you manage to get that running you still have to handle npm packages somehow, which would mean merging profiles which seems very brittle
What could be the reason for npx shadow-cljs release :main
producing a file that has 4096 lines instead of 1? The dev build is 13M, but release build is 2M so some optimization was done, but I expected all whitespace to be gone and the build being 1 liner.
How do you debug a build where the calling, npx shadow-cljs release appscript --debug
fails but npx shadow-cljs compile appscript
succeeds? More details in thread 😃... Any ideas on what to try next would be appreciated!
How do you debug a build where the calling:
npx shadow-cljs release appscript --debug
fails with:
[:appscript] Compiling ...
IllegalStateException:
com.google.common.base.Preconditions.checkState (Preconditions.java:492)
com.google.javascript.jscomp.OptimizeParameters.addVariableToFunction (OptimizeParameters.java:1025)
com.google.javascript.jscomp.OptimizeParameters.optimizeFunctionDefinition (OptimizeParameters.java:933)
com.google.javascript.jscomp.OptimizeParameters.tryEliminateConstantArgs (OptimizeParameters.java:644)
com.google.javascript.jscomp.OptimizeParameters.process (OptimizeParameters.java:128)
com.google.javascript.jscomp.OptimizeCalls.process (OptimizeCalls.java:125)
com.google.javascript.jscomp.PhaseOptimizer$NamedPass.process (PhaseOptimizer.java:317)
com.google.javascript.jscomp.PhaseOptimizer$Loop.process (PhaseOptimizer.java:462)
com.google.javascript.jscomp.PhaseOptimizer.process (PhaseOptimizer.java:232)
com.google.javascript.jscomp.Compiler.performTranspilationAndOptimizations (Compiler.java:2592)
com.google.javascript.jscomp.Compiler.lambda$stage2Passes$8 (Compiler.java:966)
com.google.javascript.jscomp.CompilerExecutor.runInCompilerThread (CompilerExecutor.java:127)
com.google.javascript.jscomp.Compiler.runInCompilerThread (Compiler.java:1014)
com.google.javascript.jscomp.Compiler.stage2Passes (Compiler.java:963)
com.google.javascript.jscomp.Compiler.compileModules (Compiler.java:905)
jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)
jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke (Method.java:568)
clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:167)
clojure.lang.Reflector.invokeInstanceMethod (Reflector.java:102)
shadow.build.closure/compile-js-modules (closure.clj:1102)
shadow.build.closure/compile-js-modules (closure.clj:1088)
shadow.build.closure/optimize/fn--11127 (closure.clj:1297)
shadow.build.closure/optimize (closure.clj:1283)
shadow.build.closure/optimize (closure.clj:1274)
shadow.build.api/optimize (api.clj:273)
shadow.build.api/optimize (api.clj:267)
shadow.build/optimize (build.clj:476)
shadow.build/optimize (build.clj:468)
shadow.cljs.devtools.api/release* (api.clj:339)
shadow.cljs.devtools.api/release* (api.clj:324)
shadow.cljs.devtools.cli-actual/do-build-command (cli_actual.clj:28)
shadow.cljs.devtools.cli-actual/do-build-command (cli_actual.clj:25)
shadow.cljs.devtools.cli-actual/do-build-commands (cli_actual.clj:49)
shadow.cljs.devtools.cli-actual/do-build-commands (cli_actual.clj:38)
shadow.cljs.devtools.cli-actual/main/body-fn--15307--auto----15979 (cli_actual.clj:166)
shadow.cljs.devtools.cli-actual/main (cli_actual.clj:165)
shadow.cljs.devtools.cli-actual/main (cli_actual.clj:132)
clojure.core/apply (core.clj:671)
clojure.core/apply (core.clj:662)
shadow.cljs.devtools.cli-actual/-main (cli_actual.clj:219)
shadow.cljs.devtools.cli-actual/-main (cli_actual.clj:217)
clojure.lang.Var.applyTo (Var.java:705)
clojure.core/apply (core.clj:667)
clojure.core/apply (core.clj:662)
shadow.cljs.devtools.cli/-main (cli.clj:75)
shadow.cljs.devtools.cli/-main (cli.clj:67)
clojure.lang.Var.applyTo (Var.java:705)
clojure.core/apply (core.clj:667)
clojure.main/main-opt (main.clj:514)
clojure.main/main-opt (main.clj:510)
clojure.main/main (main.clj:664)
clojure.main/main (main.clj:616)
clojure.lang.Var.applyTo (Var.java:705)
clojure.main.main (main.java:40)
But npx shadow-cljs compile appscript
just succeeds?:
[:appscript] Compiling ...
[:appscript] Build completed. (43 files, 42 compiled, 0 warnings, 11.39s)
shadow-cljs.edn
config:
;; shadow-cljs configuration
{:source-paths
["src"]
:dependencies
[[applied-science/js-interop "0.3.1"]]
:builds
{:appscript {;:main example.core
:target :node-library
:output-to "shadow-Code.js"
;:optimizations :advanced
:output-dir "target"
;:pretty-print false
:externs ["resources/gas.ext.js"]
:exports-var example.core/main}}}
I've tried running npx shadow-cljs check appscript
, but I'm just getting some warnings, no errors. I'm running shadow-cljs version 2.16.8
.
Hmm, that's frustrating. So basically build a empty project and see if release works, slowly paste code back in until I can pin down the issue?
hmm yeah. I've never seen this error before so no guesses as to what may be happening
hmm ok. using ^:export
in :node-library
or :node-script
builds is pointless anyways so don't use it at all 😛
I mean I'm still figuring out how to use shadow-cljs to write appscripts 😃... So this stuff is weird.