This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-11
Channels
- # aws (2)
- # beginners (38)
- # boot (21)
- # boot-dev (8)
- # cider (51)
- # cljsrn (3)
- # clojars (23)
- # clojure (99)
- # clojure-austin (7)
- # clojure-brasil (1)
- # clojure-dev (8)
- # clojure-dusseldorf (1)
- # clojure-estonia (20)
- # clojure-greece (4)
- # clojure-italy (3)
- # clojure-russia (1)
- # clojure-spec (28)
- # clojure-uk (47)
- # clojurescript (47)
- # core-logic (3)
- # cursive (9)
- # data-science (1)
- # datomic (50)
- # docs (12)
- # emacs (5)
- # fulcro (60)
- # graphql (33)
- # hoplon (8)
- # jobs-discuss (1)
- # keechma (31)
- # lein-figwheel (10)
- # leiningen (4)
- # off-topic (70)
- # om (1)
- # onyx (15)
- # pedestal (5)
- # re-frame (185)
- # reagent (14)
- # remote-jobs (8)
- # ring-swagger (7)
- # rum (17)
- # shadow-cljs (193)
- # specter (6)
- # sql (51)
- # unrepl (8)
compile is one time dev compile, watch is dev compile on repeat, release is a release compile + optimization
whenever I start writing docs I start drifting to the code and just write some other code instead
yeah, it’s tough…as you write them you discover bugs and missing things…and have to fix them right then
I’m definitely liking the i18n ideas…I just discovered that trf
is broken on extraction…compiler is moving the literal string to a var
from a plug-ins perspective, wouldn’t it be better just to give a clean API for code to store/retrieve data during compile, and then a hook to run at end of compile?
I love that macros give you the ability to extend the compiler…but it had never occurred to me that lifecycle would also be so useful.
could certainly create a proper API instead of directly messing with the cljs.env/*compiler*
atom
then an i18n package could just namespace their own atom, init it, and dump at the end
shadow-cljs has these stages currently https://github.com/thheller/shadow-cljs/wiki/Custom-builds#compilation-stages
so yeah, that kind of tooling would need a way to ensure that all files get processed
come to think of it hot reloading may actually mess up the string collection and collect repeatedly
so on startup the analyzer goes through all files, or is that timestamp shortcut too?
when a given namespace is to be compiled it is first checked if cache is available for that ns
basically just [:cljs.analyzer/namespaces the-ns]
is written to a file so anything thats in there just works
so, if there was an API with docs about the caching, then it’d be usable as a general store for general plug-ins
I’ve got some things I need to percolate on anyway…so writing some docs for your project would maybe keep me from jumping on something too quickly.
probably should check with David first. I'm just abusing the analyzer data here, not sure if that is officially ok 😉
but given the namespaced keys and general clojure philosopy on open data structures that should be ok
I’ll start a book for you tonight if you’d like. Pull together your wiki stuff and start augmenting. asciidoc ok with you?
I added :use-document-host false
then what I got was one of the stranger error logs I've seen 🙂
https://pastebin.com/MwwCmCsH
short research led me to inline scripts in html causing this, it's maybe a longshot here
https://developer.chrome.com/extensions/tut_migration_to_manifest_v2#inline_scripts
(I'm also perfectly fine not haveing hot-reload, so no stress about this)
https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/build/output.clj#L377-L378
I haven't received not-permitted error yet, but I think they include message that x feature need to be permitted. But not ruleing that one out still.
main.js:89433 DEVTOOLS: load JS goog/debug/error.js
main.js:89487 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:". Either the 'unsafe-inline' keyword, a hash ('sha256-M37Ss2WONZF7RdLxeAaEIHlfH/yox80jtDrUm4wIlr8='), or a nonce ('nonce-...') is required to enable inline execution.
it is trying to load the goog/debug/error.js
since it doesn't know that its already loaded
haha, facepalm, I was moveing node_modules folder around and shadow-cljs wasnt installed as dev-dependency. I installed it and now it's connected without warnings.
ok, just one step backward, this is the right way to start the hot-reload in the cmd
shadow-cljs cljs-repl :vast
?
yes, and the way to permit it is with sha256 hash, I guess that hash changes a lot in development
and let the script-eval
just use (js/goog.global.eval code)
instead of creating a script element
@thheller I’m looking at dev-http. I don’t see a way to plug into the middleware…am I missing anything?
in short this fixes it, but I haven't yet seen the hot reload in action, could be that I need to look closer at where shadow.cljs.devtools.client.browser
is being injected since I'm not useing the same name. Only quirk was that I had to add this into my manifest "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'"
@tony.kay you are are providing a server anyways don't you? might be best to just use that instead of the dev http server shadow-cljs provides
@hlolli I only suggested copying the file into your project to replace the one in shadow-cljs
ok, I'll zip it and send this to you. Alternatively I could replace this one file, but I'd need to know how to compile shadow-cljs
the classpath ordering will ensure that your version is loaded over the version in the jar
no error or warning in the console, I make changes, it compiles and nothing happens. You mentioned it shouldn't try to load all the files, the console looks like this:
here
(defn flush-crx-to-file
[{:keys [polyfill-js unoptimizable build-options build-sources] :as state}
{:keys [output-to] :as config}]
(let [prepend
(str unoptimizable
(output/closure-defines-and-base state)
"var shadow$provide = {};\n"
"goog.global[\"$CLJS\"] = goog.global;\n")
out
(->> build-sources
(map #(data/get-source-by-id state %))
(remove #(= "goog/base.js" (:resource-name %)))
(map #(data/get-output! state %))
(map :js)
(str/join "\n"))]
(spit output-to (str prepend out)))
state)
hmm you could try just adding :devtools {:async-require true}
and just use the default :browser
output
the async-require
will load things via fetch
instead of the usual closure debug loader
is there a recommended “path of least awkwardness” for deploying maven artifacts from a clojure project which is otherwise fully ‘managed’ by shadow-cljs?
I hope someone writes a generic deploy utility library that isn’t coupled to a build tool (ie. also works with tools.deps
)
hm. I guess I could have the project.clj read :source-paths
and :dependencies
from shadow-cljs.edn
, https://stackoverflow.com/a/7741790/3421050
similar to this https://clojureverse.org/t/combining-tools-deps-with-leiningen/658/4?u=thheller
boom! https://gist.github.com/hlolli/265b9183566a4c5829d7ee355e3d0998 @thheller ❤️
BUJAKA!
main.js:89714 DEVTOOLS: connected!
main.js:89714 DEVTOOLS: REPL init successful
main.js:89714 DEVTOOLS: load JS vast/core.cljs
core.cljs:31 BUJAKA!
main.js:89714 DEVTOOLS: load JS vast/core.cljs
core.cljs:31 BUJAKA!
> I hope someone writes a generic deploy utility library that isn’t coupled to a build tool While I agree that this would be a nice thing, deploying is a somewhat complex task and in the end you’ll end up with something like lein or boot. Now you have three things 🙂
but if boot had a declarative configuration for that I could just call clj -m boot.deploy
😉
declarative as in reading from a file?
and are you attached to running clj
instead of boot
? 😉
It’s an interesting idea to not have a binary like lein
boot
and just invoke namespaces
All Clojure build tools were conceived at a time when there was no tool to construct a classpath for you
> I like boot but I don’t like that its all code and not really very declarative It doesn’t have declarative interfaces because those generally end up falling short — that said bolting declarative interfaces on top of boot is something that is very trivial and should probably be embraced more
It would be interesting to see what boot would look like if there was no boot
binary
https://code.thheller.com/blog/shadow-cljs/2017/11/18/the-many-ways-to-use-shadow-cljs.html
java -cp (clj -Spath) boot.App repl
running boot without boot
😄
> too bad clojure makes it so hard to run isolated instances, too much static stuff not sure I understand what you mean @thheller