This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-06
Channels
- # announcements (4)
- # beginners (132)
- # calva (37)
- # chlorine-clover (60)
- # cider (1)
- # clara (12)
- # clj-kondo (40)
- # cljs-dev (109)
- # clojure (76)
- # clojure-dev (19)
- # clojure-europe (8)
- # clojure-france (17)
- # clojure-nl (4)
- # clojure-sg (1)
- # clojure-spec (14)
- # clojure-uk (7)
- # clojurescript (98)
- # conjure (96)
- # cursive (15)
- # data-science (2)
- # datalog (11)
- # datomic (24)
- # emacs (17)
- # figwheel-main (3)
- # fulcro (45)
- # jobs-discuss (1)
- # kaocha (3)
- # malli (2)
- # nrepl (1)
- # off-topic (135)
- # portal (2)
- # re-frame (17)
- # reagent (11)
- # reitit (4)
- # sci (60)
- # shadow-cljs (75)
- # spacemacs (3)
- # sql (32)
- # tools-deps (79)
- # vim (88)
- # xtdb (4)
@noisesmith Sorry I'm not actually sure how pulling a "helper" namespace in js modules might work :thinking_face: Like how might I run the js code base with some cljs? With clojurescript tools?
the clojurescript compiler takes cljs source code, and creates js code, your js files can use those the same as they'd use other external js deps
@zackteo there's actually a lot of ways to do that, and no it doesn't need to be all at once
it might help to know what your JS app looks like and then it will be easier to say which route you should take
The code base im thinking of is a GIS web app. Running with React, Leaflet (can't quite recall if there's any more similarly big dependencies)
at this point it doesn't really matter what tool you use shadow-cljs, Figwheel - it's mostly a matter of taste
It might take a little bit of work to get it setup depending on how your app works, but fundamentally ClojureScript is designed to do what you want
shadow-cljs probably has the most affordances if you're coming from JS and looking for a fast on board
but plain ClojureScript and Figwheel are certainly capable of accomplishing more or less the same thing
Got it! Thanks for your help!! Didn't know there was such a guide - but probably cause I didnt think to search from webpack
I see I see, I'm just generally trying to entertain the possibility of introducing ClojureScript to a company I was interning at cause I genuinely felt a lot of their pain points could be eased with ClojureScript.
Not that the 1 year to be fresh grad me, would easily be able to make such a seemingly drastic change unless quite miraculously. But am exploring my options as I hope to be able to start my career with Clojure/(Script) somehow
yeah, I interpreted your question too literally - you can take an existing js code base and add new cljs code, and use both together
Doesn't help that I'm in Singapore atm with pretty much no Clojure/(Script) being used anywhere - or at least based on what I know - companies too risk adverse :man-shrugging:
@noisesmith no worries!
A while ago, I read a post on something like Clojureverse or r/Clojure about Chrome discontinuing support for whatever makes Dirac DevTools tick. I can’t find it again. Did I just dream it?
but decided to keep it the way it is for now, thanks to twitter response of affected cljs users
Awesome!
@U08E3BBST I’ve decided to try Dirac again. I’m using the command line tool to start up Chromium, and navigating to localhost:3449 , the address of my application. However, I’m getting
Version mismatch: Dirac Runtime installed in your app has different version (v1.6.1) than Dirac Chrome Extension (v1.6.0).
To avoid compatibility issues, please upgrade all Dirac components to the same version: .
on Dirac initialization, along with a bunch of errors like
core.cljs:322 Uncaught Error: No protocol method ISwap.-swap! defined for type cljs.core/Atom: [object Object]
from my application. Do you have a hunch about what I could be doing wrong?I tried with two different applications, and the result seems to be the same.
I forced use of 1.6.1
after seeing the error by adding and sourcing the env var export DIRAC_CLI_VERSION=1.6.1 dirac
Which dirac
seems to react on - the version stated in the terminal on initializing dirac
is now 1.6.1
, where it was 1.6.0
before, but the error message in the browser seems to be the same.
I just installed the dirac CLI, so I don’t understand the incompatability errors. I depended on binaryage/devtools
in one of the projects I tried, but removed the dependency, and it made no difference.
@U0AQ3HP9U “Dirac Runtime” is a library you are using in your app, you should bump deps in your app
https://github.com/binaryage/dirac/blob/master/docs/installation.md#install-the-dirac-runtime
@U08E3BBST I had misunderstood. I thought that just installing and running Chromium with the CLI would be sufficient.
Wow, it’s very involved. And I won’t even be able to use it with the project I intended, since that already uses piggieback middleware.
I just want to see how it can help me 🙂
likely not much, Dirac helps in advanced scenarios when you want to step through cljs code in devtools a maybe eval some cljs code at breakpoints
It wasn’t obvious to me that the part was optional.
Hm, well. Maybe I’ve been missing that eval feature more than I knew. 🙂
But I’m still getting the same errors, after having included the dependencies with the correct versions.
the message above said that you have 1.6.1 in your app but the extension was 1.6.0 to me it looks like your chrome canary is not the latest, so the CLI picked dirac 1.6.0 not 1.6.1
here is the mapping between chrome versions and dirac versions https://github.com/binaryage/dirac/blob/master/releases.edn
anyways you might want to ignore that warning, there were no changes in dirac runtime between those two versions
Hm, ok. I installed Chromium today with brew cask
, perhaps that’s not the newest version.
But regardless of that warning being irrelevant, I’m still getting errors like
http_client.cljs:25 Uncaught Error: No protocol method ISwap.-swap! defined for type cljs.core/Atom
doe@Srens-MacBook-Pro-2 ~ $ dirac
Located Chromium executable at '/usr/local/Caskroom/chromium/793929/chromium.wrapper.sh'.
Detected Chromium version '86.0.4220.0'
Resolved matching Dirac release as '1.6.0'
Matching Dirac release is located at '/Users/doe/.dirac/silo/v/1.6.0'
Preparing playground environment at '/Users/doe/.dirac/playground'
Compiling playground project...
Starting playground HTTP server on port 9112
Booting Dirac Agent...
Starting nREPL server v0.8.0 on port 36180
-----------------------------------------------------------------------------------------------------------
WARNING!
We detected unexpected tools.nrepl library version in your nREPL server at !
The server reported version 0.8.0, but Dirac expected version 0.7.0.
This could potentially lead to unexpected behaviour. Please check your dependencies and use latest Dirac release.
For reference, the reported versions by the nREPL server are:
{:clojure "1.9.0", :java "1.8.0_92", :nrepl "0.8.0"}
Also double check Dirac installation instructions: .
-----------------------------------------------------------------------------------------------------------
Dirac Agent v1.6.1
Connected to nREPL server at .
Agent is accepting connections at .
Launching Chromium [with --user-data-dir='/Users/doe/.dirac/chromium/profiles/default'] ...
[51968:775:0806/214551.159883:ERROR:(208)] [21:45:51.146] FIDO: Touch ID authenticator unavailable because keychain-access-group entitlement is missing or incorrect
I’ll try that.
in general I would not recommend cask for Canary, it self-updates so there is no need to have it managed by brew
Aha. Well, I just like installing everything with brew - it fits better in my head that way, rather than a sprawl of different install methods.
This looks a bit better:
doe@Srens-MacBook-Pro-2 ~ $ dirac
Downloading: binaryage/dirac/1.6.0/dirac-1.6.0.pom from
Downloading: org/clojure/core.async/1.2.603/core.async-1.2.603.pom from
Downloading: nrepl/nrepl/0.7.0/nrepl-0.7.0.pom from
Downloading: nrepl/nrepl/0.7.0/nrepl-0.7.0.jar from
Downloading: binaryage/dirac/1.6.0/dirac-1.6.0.jar from
Downloading: org/clojure/core.async/1.2.603/core.async-1.2.603.jar from
Located Chromium executable at '/usr/local/Caskroom/chromium/793929/chromium.wrapper.sh'.
Detected Chromium version '86.0.4220.0'
Resolved matching Dirac release as '1.6.0'
Matching Dirac release is located at '/Users/doe/.dirac/silo/v/1.6.0'
Preparing playground environment at '/Users/doe/.dirac/playground'
Compiling playground project...
Starting playground HTTP server on port 9112
Booting Dirac Agent...
Starting nREPL server v0.7.0 on port 36180
Dirac Agent v1.6.0
Connected to nREPL server at .
Agent is accepting connections at .
Launching Chromium [with --user-data-dir='/Users/doe/.dirac/chromium/profiles/default'] ...
[52115:775:0806/215217.364371:ERROR:(208)] [21:52:17.344] FIDO: Touch ID authenticator unavailable because keychain-access-group entitlement is missing or incorrect
Same type of errors though, things not being defined and all that.
Well, no - not when I run the app in regular Chrome. Only in Chromium.
As started by Dirac.
Maybe I should try just running Chromium without dirac and see if the app works there…
Yeah, works fine there, too.
there are two things, 1) chromium with dirac breaks things 2) dirac runtime in your app break things
if you test your app compiled with dirac runtime in normal chrome/chromium, does it work?
Yes, that’s what I’m doing now.
I guess 2 is the case, because it dirac runtime brings some deps which might clash with your existing deps
No errors of any kind.
It seems to be 1).
But you are right; when I used dirac as a :dev
profile dependency, there were clashes. Perhaps now that I’m using it as a part of the normal :dependencies
vector, there are clashes that I don’t see.
For whatever reason.
Yeah, lots of suggested :exlusions
from lein deps :tree
…
Perhaps I should try those before I do anything else 🙂
Gotta try that tomorrow.
Is there a nice way of logging stacktraces that make sense with advanced compilation turned on? :s
Is there a trick to get the contents of a var at compile time in macros? ....no?
It seems to return the vars analysis map? Can I use it to infer the contents of the var?
By reading the content from disk given the start and end location? 🙂
Yes, that's what I figured. I have to come up with something else then, giving more responsibility to the runtime. Thanks anyway!
Hiya! I see the https://clojurescript.org/reference/compiler-options#target`:target`https://clojurescript.org/reference/compiler-options#target:
> Valid options are :nodejs
, :webworker
and :bundle
.
> The default (no :target
specified) implies browsers are being targeted.
But I see https://github.com/Olical/cljs-test-runner/blob/4bb157623f610429b1740e366aaa4090743ba968/src/cljs_test_runner/main.clj#L137-L152`:browser`https://github.com/Olical/cljs-test-runner/blob/4bb157623f610429b1740e366aaa4090743ba968/src/cljs_test_runner/main.clj#L137-L152`:target`. Is this a thing? Or is it simply that an unrecognized :target
also chooses the default?
cljs.core/find-ns-obj
throws on any target other than nodejs, webworker, or default. That is, unless *target*
there is something else entirely.
Thanks for replies! I see a https://github.com/clojure/clojurescript/blob/f5f9b79f6f446cef768e190971cf67fc78bf5b93/src/main/clojure/cljs/closure.clj#L1745`cljs.closure/output-main-file`. I wonder if the cli usage help for target might mislead a bit in its wording?
-t, --target name The JavaScript target. Configures environment
bootstrap and defaults to browser. Supported
values: node or nodejs webworker, none
target defaults to browser but browser is not a supported value.(Just thinking out loud how :browser might have been considered a valid val for target)
devcards is super awesome. getting it back into our codebase and just remembering how great it is
... Good eve, just a quick question: Does anyone know the reason why GraalJS was removed recently? I can't seem to find the reason behind its removal (it was removed along with Rhino and Nashorn which is understandable because they were declared obsolete and unmaintainable in OpenJDK), but for GraalJS, googling didn't help. Here's the link where I read it: https://clojurescript.org/news/2020-04-24-release
This commit message sheds some light: https://github.com/clojure/clojurescript/commit/747de66411122be00fa145a04d9741722a35c1c5