This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-30
Channels
- # adventofcode (22)
- # announcements (7)
- # beginners (32)
- # calva (56)
- # cider (96)
- # cljdoc (7)
- # cljs-dev (50)
- # clojure (173)
- # clojure-austin (8)
- # clojure-brasil (7)
- # clojure-europe (10)
- # clojure-greece (2)
- # clojure-italy (10)
- # clojure-nl (9)
- # clojure-spec (18)
- # clojure-uk (143)
- # clojurebridge (3)
- # clojurescript (9)
- # cursive (14)
- # data-science (1)
- # datascript (4)
- # datomic (9)
- # docker (7)
- # emacs (2)
- # figwheel-main (4)
- # fulcro (18)
- # garden (1)
- # graphql (13)
- # hyperfiddle (4)
- # juxt (2)
- # off-topic (43)
- # pathom (1)
- # pedestal (17)
- # portkey (163)
- # re-frame (4)
- # reitit (7)
- # rum (4)
- # shadow-cljs (139)
- # spacemacs (5)
- # sql (14)
- # unrepl (2)
@thheller I did npm i shadow-cljs -g and it gave me that version I pasted above, but its still giving me release snapshots
on the console. How do I tell what version of shadow is actually executing? I don't see any -version
option
@vigilancetech you also should install shadow-cljs as a dependency in your application's project. the shadow-cljs
command will use whatever version of it is installed in your project
@lilactown hmm... my project dependency file doesn't have any dep for shadow. Wouldn't it automatically be using the newest installed then?
@vigilancetech yeah I absolutely recommend installing shadow-cljs in your project. easier to ensure you get the correct version
I need some advice. For two of the Calva extensions to VS Code I have a shadow-cljs based tool-chain, where TypeScript is used to create the extension entry point and shadow-cljs is used to compile the ClojureScript code into a JavaScript library that the TypeScript code then consumes. For when the extensions need to share logic I have so far relied on them exposing API:s to each other. But this creates a dependency between them that I rather not want to have. So I am leaning towards creating a lib that is published in a way that all my extensions can use. The options I see are either to build a CLJS library that I can put on clojars, or a JS library that I publish as an NPM module. Do I have other options that I don't see? (I think that a CLJS library makes the most sense, but am not fully clear about what my tradeoffs are.)
I don't quite understand why you have different extensions and how they interact with each other
TypeScript is what I use to integrate into VS Code. (I have changed this quite a few times, but the only thing that really worked for me was this setup.)
They are different extensions because they solve different enough problems, so someone can use some other REPL extension and still use Calva Formatter (for instance).
I also have a third extension, Calva Paredit, that is still TypeScript only, but that I am going to change to the same toolchain so that I can use some of functions that I have developed for the formatter.
since the whole idea of whole-program-optimizations breaks pretty badly if you don't have the whole program
Ah, but I never got the :npm-module
working last time I tried it. So went back to :node-library
even though the API is pretty thick.
Why is one-lib preferable over each extension having its own CLJS lib that each are using a common lib?
But, sorry if I am a bit thickheaded, I use libraries from Clojars all the time, and have never seen this problem. Aren't they compiled into my code just like any other code?
which will give you https://github.com/thheller/npm-module-demo/blob/master/src/main/foo/bar.cljs
doesn't need to be a scoped package. just didn't want to create another "global" dummy package on npm
the typescript code can then just require("calva-core/foo.bar")
so get access to whatever CLJS fn it needs
of course that is totally optional but with 3 different extensions that means cljs.core
will only be loaded once
still don't understand what role the typescript plays in all of this of how much of the code you actually share
Will the CLJS code have as easy access to the functions in this module as well? Seems like it will publish a JS API. Which is not too much of a bother, I am mainly curious.
the CLJS in calva-core
can talk to any other CLJS in calva-core
but not to any other CLJS not in calva-core
the only thing to remember really is your builds. a CLJS build can only consume uncompiled CLJS code, it can never consume compiled CLJS code (macros would not work)
so if you want 3 separate CLJS builds than putting a uncompiled CLJS library on clojars is your only option
if you however have 3 separate typescript builds then putting one compiled CLJS build on npm is fine
I currently have three separate TS builds and two separate CLJS builds, but I'm willing to try something else. 😃
I would probably get rid of the TS completely but if that is important to you it should be fine
It is only important to me because it was the only way I could get my development process work.
2. Unhandled clojure.lang.Compiler$CompilerException
Error compiling shadow/build/compiler.clj at (455:13)
1. Caused by java.lang.RuntimeException
Unable to resolve var: comp/*source-map-data-gen-col* in this context
Show: Project-Only All
Hide: Clojure Java REPL Tooling Duplicates (23 frames hidden)
1. Unhandled clojure.lang.ExceptionInfo
missing instance
{}
core.clj: 4739 clojure.core/ex-info
core.clj: 4739 clojure.core/ex-info
runtime.clj: 11 shadow.cljs.devtools.server.runtime/get-instance!
runtime.clj: 8 shadow.cljs.devtools.server.runtime/get-instance!
api.clj: 130 shadow.cljs.devtools.api/worker-running?
api.clj: 128 shadow.cljs.devtools.api/worker-running?
api.clj: 207 shadow.cljs.devtools.api/watch
api.clj: 201 shadow.cljs.devtools.api/watch
api.clj: 205 shadow.cljs.devtools.api/watch
api.clj: 201 shadow.cljs.devtools.api/watch
REPL: 1 user/eval55989
REPL: 1 user/eval55989
Compiler.java: 7062 clojure.lang.Compiler/eval
Compiler.java: 7051 clojure.lang.Compiler/eval
Compiler.java: 7025 clojure.lang.Compiler/eval
core.clj: 3206 clojure.core/eval
core.clj: 3202 clojure.core/eval
main.clj: 243 clojure.main/repl/read-eval-print/fn
main.clj: 243 clojure.main/repl/read-eval-print
main.clj: 261 clojure.main/repl/fn
main.clj: 261 clojure.main/repl
main.clj: 177 clojure.main/repl
RestFn.java: 137 clojure.lang.RestFn/applyTo
core.clj: 657 clojure.core/apply
core.clj: 652 clojure.core/apply
regrow.clj: 18 refactor-nrepl.ns.slam.hound.regrow/wrap-clojure-repl/fn
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 87 clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 657 clojure.core/apply
core.clj: 1965 clojure.core/with-bindings*
core.clj: 1965 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
interruptible_eval.clj: 85 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 55 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 222 clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
interruptible_eval.clj: 190 clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn
AFn.java: 22 clojure.lang.AFn/run
ThreadPoolExecutor.java: 1142 java.util.concurrent.ThreadPoolExecutor/runWorker
ThreadPoolExecutor.java: 617 java.util.concurrent.ThreadPoolExecutor$Worker/run
Thread.java: 745 java.lang.Thread/run
but instead some other JVM running an nrepl server (that happens to have the shadow-cljs dependency loaded)
you can use the embedded version https://shadow-cljs.github.io/docs/UsersGuide.html#embedded if you prefer running shadow-cljs inside your other JVM
FWIW it doesn't matter how large your server-side is. it is perfectly fine to use project.clj
for the server-side and shadow-cljs.edn
for the CLJS side of things
Doh. I'll probably make some PRs both to cider and shadow docs after the weekend 🙂
I don't use emacs and the setup seems to be changing somewhat regularly. so the instructions somehow constantly change and its impossible for me to keep up.
1. Unhandled java.lang.IllegalStateException
Can't change/establish root binding of: *nrepl-cljs* with set
Var.java: 223 clojure.lang.Var/set
api.clj: 361 shadow.cljs.devtools.api/nrepl-select
api.clj: 356 shadow.cljs.devtools.api/nrepl-select
api.clj: 358 shadow.cljs.devtools.api/nrepl-select
api.clj: 356 shadow.cljs.devtools.api/nrepl-select
REPL: 1 user/eval73496
REPL: 1 user/eval73496
Compiler.java: 7062 clojure.lang.Compiler/eval
Compiler.java: 7052 clojure.lang.Compiler/eval
Compiler.java: 7025 clojure.lang.Compiler/eval
core.clj: 3206 clojure.core/eval
core.clj: 3202 clojure.core/eval
main.clj: 243 clojure.main/repl/read-eval-print/fn
main.clj: 243 clojure.main/repl/read-eval-print
main.clj: 261 clojure.main/repl/fn
main.clj: 261 clojure.main/repl
main.clj: 177 clojure.main/repl
RestFn.java: 137 clojure.lang.RestFn/applyTo
core.clj: 657 clojure.core/apply
core.clj: 652 clojure.core/apply
regrow.clj: 18 refactor-nrepl.ns.slam.hound.regrow/wrap-clojure-repl/fn
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 87 clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 657 clojure.core/apply
core.clj: 1965 clojure.core/with-bindings*
ok, I've installed shadow 2.7.6 both globally, in my project directory, in the devDependencies in package.json, and as a dependency of my project in shadow-cljs.edn and THIS is what I get when I start the server in the project directory:
shadow-cljs - config: /home/kevin/0work/guardian-dashboard/shadow-cljs.edn cli version: 2.3.24 node: v8.12.0
Why? Is there a cache somewhere I need to clean out first?
doing a global grep of my project folder shows no file contains "2.3.24" anymore
@vigilancetech what are ytou using to start? lein
or deps.edn
? probably not just shadow-cljs.edn
right?
what does /home/kevin/0work/guardian-dashboard/node_modules/shadow-cljs/package.json
say?
oh, sorry, I was wrong about nothing saying "2.3.24". I was using grep from within emacs and it just was very slow in returning results. I must have been swap bound. There are a lot of instances of that in that file under node_modules. No, I'm just using shadow cli version with the shadow-cljs.edn
file
{
"_from": "[email protected]",
"_id": "[email protected]",
"_inBundle": false,
"_integrity": "sha512-jmk9e9/8KbJOQI16Ww9bC8R3uleZFm1wvFKrnmYVFQrmB8opnVMeo5Z5HlNLo38rV9gpmyk797ayeeFRUH+lkA==",
"_location": "/shadow-cljs",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "[email protected]",
"name": "shadow-cljs",
"escapedName": "shadow-cljs",
"rawSpec": "2.3.24",
"saveSpec": null,
"fetchSpec": "2.3.24"
},
"_requiredBy": [
"#DEV:/",
"#USER"
],
"_resolved": "",
"_shasum": "44249c7dc6e0c7f4b77f547005a03772424a744e",
"_spec": "[email protected]",
"_where": "/home/kevin/0work/guardian-dashboard",
"author": {
"name": "Thomas Heller"
},
"bin": {
"shadow-cljs": "./cli/runner.js"
},
"bugs": {
"url": ""
},
"bundleDependencies": false,
"dependencies": {
"babel-core": "^6.26.0",
"babel-preset-env": "^1.6.0",
"mkdirp": "^0.5.1",
"node-libs-browser": "^2.0.0",
"readline-sync": "^1.4.7",
"shadow-cljs-jar": "1.1.2",
"signal-exit": "^3.0.2",
"source-map-support": "^0.4.15",
"ws": "^3.0.0"
},
"deprecated": false,
"description": "ClojureScript compiler and JS bundler",
"disabled-scripts": {
"install": "node ./cli/runner.js aot"
},
"engines": {
"node": ">=6.0.0"
},
"homepage": "",
"jar-version": "2.3.24",
"keywords": [
"clojurescript",
"cljs"
],
"license": "ISC",
"name": "shadow-cljs",
"repository": {
"type": "git",
"url": "git+"
},
"version": "2.3.24"
}
yes, right, but I did the npm i shadow-cljs
in my project folder after changing the package.json shadow version. I have to change it here too?
{
"name": "guardian-dashboard",
"version": "3.3.2",
"description": "UI to JBOG guardian server",
"main": "guardian/dashboard.js",
"directories": {
"doc": "doc"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+"
},
"author": "Jessie Umblerg/Kevin Haddock",
"license": "private trade secret",
"bugs": {
"url": ""
},
"homepage": "",
"dependencies": {
"electron": "^3.0.6",
"jquery": "^3.3.1",
"markdown": "^0.5.0",
"npm": "^6.4.1",
"querystring": "^0.2.0",
"url": "^0.11.0",
"util": "^0.11.0"
},
"devDependencies": {
"shadow-cljs": "^2.7.6"
}
}
actually I think I did npm i shadow-cljs
after editing it manually
and it confirmed it installed 2.7.6
pretty sure. I can try it again
all my terminal sessions are in that directory
ok, I just did an npm i
in that directory and now the package.json in the node_modules/shadow-cljs
says 2.7.6
I'm pretty sure I ran the npm i shadow-cljs
in there after changing the version in the package.json in the project's home folder and making it a dep in the shadow-cljs.edn and it didn't properly update it (even tho it said it did). I'll have to check that out again next time shadow's version number gets bumped to see if it does the same thing again.
are npm included libraries analyzed by google closure to eliminate not accessible code?
they are run through closure but only with :simple
optimziations. it does some DCE but not the real stuff.
@lilactown they are processed and not treated like foreign libs