Clojurians
#cljs-dev
<
2018-02-05
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

dnolen08:02:40

@richiardiandrea we could consume embedded ones and I don’t really have an issue with generating embedded ones - but it should be behind a flag

dnolen08:02:57

the only place where we support it I believe is the REPL, where we use them when compiling expressions

dnolen08:02:09

@richiardiandrea ah you’re talking specifically about self-hosted here

richiardiandrea15:02:13

I have a small patch ready with source-map-inline = true. I need some time to check if it works properly

richiardiandrea15:02:24

Yep I have a q: are source maps composed of multiple files usually? If a namespace requires clojure.string for instance, should I see it in the source maps? Because it does not seem to show up in my self-host source maps...

dnolen15:02:55

in self-host I though we always inline, so I’m not sure what you mean

mfikes16:02:27

@richiardiandrea If a namespace requires clojure.string, then, if :source-map is set to true, the source maps for clojure.string would be appended to the end of the generated JavaScript for the clojure.string namespace.

richiardiandrea16:02:02

Oh the whole encoded file? ok that is not what I am seeing, will dig more. Thanks you both

mfikes16:02:20

Yeah, it is appended to the source via https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/js.cljs#L157 But to be honest, I never found that useful because it requires the JavaScript environment to do something with it. What seems to be more important, IMHO, is that source maps are included under the :source-maps key of the compiler state.

richiardiandrea16:02:48

One thing that I wanted to document is that the name key to eval-str is used in the source maps so in lumo I was passing the namespace instead: https://github.com/anmonteiro/lumo/pull/349/files#diff-4da6b6777b07770bfe3ffbd39a773e33R1152

richiardiandrea16:02:22

Don't know how correct this is but I have reverse engineered it by reading the piece of code you just linked :)

richiardiandrea17:02:11

So folks here is what I get (`:verbose` on from the compiler, thanks for this feature!):

{"version" 3
                       "file" "repro/expound_tuple.js?rel=1517796376596"
                       "sources" ["expound_tuple.cljs?rel=1517796376596"]
                       "lineCount" 14
                       "mappings" ";AAOA,+CAAA,/CAAMA,sGACHC,MAAMC;AADT,AAGE,4BAAA,5BAACC,qCAAiBF;;AAClB,AAACG,YAAeF;;AAChBA;;AAyBF,8BAAA,9BAAMG;AAAN,AAEE,kCAAA,3BAACC"
                       "names" ["repro.expound-tuple/lumo-prepare-stack-trace","error","stack","cljs.core/println","js/console.dir","repro.expound-tuple/test-sm","cljs.core/ffirst"]
                       "sourcesContent" ["(ns repro.expound-tuple\n ..."]}

richiardiandrea17:02:09

the sources field is only one and not relative, which to me sounded strange and when I tried with source-map-explorer it was complaining that it is only one file (shouldn't be many?): https://www.npmjs.com/package/source-map-explorer#generating-source-maps

richiardiandrea17:02:24

I (but I am not an expert by any means) expected cljs.core and clojure.string to be in sources.