This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-20
Channels
- # aleph (19)
- # aws-lambda (8)
- # bangalore-clj (1)
- # beginners (13)
- # boot (179)
- # cljs-dev (12)
- # cljsjs (2)
- # cljsrn (6)
- # clojure (174)
- # clojure-italy (14)
- # clojure-nl (2)
- # clojure-russia (172)
- # clojure-spec (29)
- # clojure-uk (22)
- # clojurebridge (10)
- # clojureremote (1)
- # clojurescript (79)
- # cursive (46)
- # data-science (1)
- # datascript (8)
- # datomic (18)
- # defnpodcast (2)
- # emacs (9)
- # events (6)
- # hoplon (11)
- # klipse (13)
- # lein-figwheel (1)
- # leiningen (1)
- # luminus (1)
- # lumo (88)
- # numerical-computing (1)
- # off-topic (24)
- # om (33)
- # onyx (58)
- # protorepl (8)
- # re-frame (10)
- # reagent (26)
- # ring (8)
- # ring-swagger (7)
- # rum (22)
- # spacemacs (25)
- # specter (5)
- # uncomplicate (37)
- # untangled (75)
- # vim (17)
- # yada (3)
I've been using ES6 and Babel on a project for a few months now, and I like fetch
's syntax. That may not be a good enough reason to use fetch
and a polyfill, though.
I'm starting to wonder if I'm approaching this the wrong way. fetch
isn't the only ES6 feature that's not universally supported, but that I've gotten accustomed to using.
compile your es6 related things to a lib.js
and include that in your page manually or via :foreign-libs
I think I've been treating CLJS as a really thin wrapper around JS, rather than as a language in its own right.
I should probably start looking for more ways to do things that are idiomatic to CLJS.
michaelstalker: https://github.com/r0man/cljs-http is a good library that can also handle serialization/deserialization into the format of your choice.
Thanks so much! I'll check it out.
I'll do some reading on core.async, as well.
That's what I would recommend, if the syntax of fetch
is nicer to you, wrap up XhrIo
to make it look like fetch
.
I upgraded React Virtualized to 9.0.0-rc.0 in cljsjs (locally) and I get: https://www.dropbox.com/s/ovgbpj1x368yhfd/Screenshot%202017-02-20%2012.51.37.png?dl=0
i think i’m seeing a regression in the way the cljs compiler produces paths for sources in source maps starting at version 1.9.198
in version 1.9.89, sources are relative to the map file, and in 1.9.198, they are relative to output-to directory
but they are still relative paths, not absolute, so they’re loaded by the browser with a doubled relative path since they’re being loaded from the relative path of the .js file in the same dir as the .js.map
for example, if i have (ns sourcemap.demo)
in src/sourcemap/demo.cljs
, i’ll see target/main.out/sourcemap/demo.js
and target/main.out/sourcemap/demo.js.map
@pleasetrythisathome have you tried to play with :source-map-asset-path
and :source-map-path
compiler options?
in 1.9.89, demo.js.map has ”sources”: [”demo.cljs"]
in 1.9.198, demo.js.map has ”sources”: [”main.out\/sourcemap\/demo.cljs"]
yes, :asset-path
works as i expect, but :source-map-path
and :source-map-asset-path
seems to be ignored by both versions
in 1.9.198, if you log something from the cljs file, you’ll see the correct line number mapped in the console, but the path to the source will be doubled as /main.out/sourcemap/main.out/sourcemap/demo.cljc
with clojure.spec, is there a way to define a more “human-readable” spec for nested maps?
(s/def ::my-domain-entity (s/keys :req-un [:a :b])
(s/def :a (s/keys :req-un [:c :d]))
(s/def :b boolean?)
(s/def :c number?)
(s/def :d string?)
My complaint is that it becomes hard(er) to read a spec if it has any sort of nested maps or any deep structure… because you are chasing keys up and down a file and they aren’t “in place” declarations.
Rather than something like schema which would allow
(m/defschema my-domain-entity {:a {:c sc/number :d sc/string} :b sc/bool}}
@pleasetrythisathome :source-map-asset-path
should be a thing in 1.9.198, does not exist in .89:
https://github.com/clojure/clojurescript/commit/17bcf2a091accb6f7caf1e8fa3954b490e9d34fa
looking at the blame view, looks like david touched the relevant code about 8 months ago: https://github.com/clojure/clojurescript/blame/master/src/main/clojure/cljs/compiler.cljc#L1225-L1250
which would be at that commit
ok, let me see if i can fix the issue with :source-map-asset-path in the newer versions
has everyone else’s source maps not broken?
commit also claims to fix :source-map-path support under optimizations none
by reading it you should be able to figure out what is going wrong in your case, it looks to me that you have to make sure :source-map-asset-path
is not set and :source-map-url
is also not set, then you trigger the code path which will produce relative names to generated cljs files not :output-dir
you want to trigger this code path: https://github.com/clojure/clojurescript/blame/master/src/main/clojure/cljs/compiler.cljc#L1238
hmm ok let me play around
so it was actually an issue with boot-cljs that started with this commit https://github.com/clojure/clojurescript/commit/62322742840c467b30159da6c96dd86199afd53f
:source-map-path was broken, and boot-cljs had been passing :source-map-path incorrrectly for the apparently intended behavior
should be the absolute :output-dir, not relative, currently “main.out"
should be “/main.out” in the standard case
@risto (bar [this x] (-bar this x))
is the usual convention and then spec -bar
.
This issue suggests the other way, wrapping the protocol fn with a global one and spec-ing that. I find other advantages to this pattern. For example, I usually can't add breakpoints with the Cider debugger in protocol methods, I get 'method too large'.
Actually, that isn't much help seeing as we're in #clojurescript
risto: You would usually do that with (defn-
which defines a private method (adds a tag to the metadata).
No special meaning afaik. It's just a convention, probably made popular because Clojurescript uses it for built-in protocols.
Generally, I use it in cases like this where I can't think of a good name for the inner function that is different from the wrapper.
Has anyone used compassus as a routing library with om-next? I'm wondering how to set query parameters when setting the route. Can anyone help?
@dnolen I'd like to add http://crepl.thegeez.net to https://github.com/clojure/clojurescript/wiki/Bootstrapping-the-Compiler Can I edit the wiki myself or do I need to make a PR somewhere?
Hi there, I got a cljsbuild error using compiler modules. See https://github.com/bhauman/lein-figwheel/issues/527#issuecomment-280915218 Hope you can help me 🙂
I have foo.edn, which I want src/g/bar.cljs to read in at compile time, not run time -- is there a easy way to do this?
@qqq you can splice the contents of that file into your code by writing a macro do that
I'm trying to get my function spec working, but it doesn't check the return value:
(s/fdef hello
:args (s/cat :name string?)
:ret string?)
(defn hello [name]
;(str "Hello, " name)
(+ 1 2)
)
(stest/instrument [`foob `fooob `hello])
"Instrumentation validates that the :args spec is being invoked on instrumented functions and thus provides validation for external uses of a function"
"Note that the :ret and :fn specs are not checked with instrumentation as validating the implementation should occur at testing time."
@qqq Pragmatic solution: (read-string (str "(" x ")"))