-
Notifications
You must be signed in to change notification settings - Fork 85
Improve inline source mapping and error reporting #349
base: master
Are you sure you want to change the base?
Conversation
b8c7b66
to
33ce429
Compare
ff56240
to
42f262c
Compare
42f262c
to
60a222c
Compare
I updated the code in order to include planck-repl/planck@27a8e07 and planck-repl/planck@15a89b0 as well. I tried to compile against the latest |
There is a new patch for CLJS-2492, waiting for some feedback. |
CLJS-2492 has been merged! I will rebase this branch on master but I feel #353 should go in first so that it is easier to build against newer ClojureScript versions. What do you think @anmonteiro? |
60a222c
to
3c07e02
Compare
3c07e02
to
5f49e7b
Compare
@anmonteiro this basically does part of the work you have in the older https://github.com/anmonteiro/lumo/commits/smaps. It does not have core files and source maps loading but it works pretty well at the REPL because every required namespace already populates the How about merging and adding core file maps on top? In a separate PR I mean? |
5f49e7b
to
313cbfe
Compare
313cbfe
to
3dd2561
Compare
Rebased. |
f94fa15
to
323bff1
Compare
323bff1
to
e013702
Compare
Back into WIP mode in order to add the final |
6272fd0
to
a7ae700
Compare
This should be ready to review, I added Mike as well for visibility 👍 but probably things are slightly different in |
a0eea8f
to
6ff8914
Compare
This patch enables source maps for expressions that include a load form and only for that. Eval option decision-making is now centralized in make-eval-opts.
Thanks to CLJS-2492 we can safely pass a namespace to the name parameter and this will be used as key in (:source-maps @st). The namespace will be extracted from the input expression if and only if it is a ns form.
The patch follows in the footsteps of Planck, reading from (:source-maps @st), introducing calls to cljs.stacktrace and printing out the stack traces.
6ff8914
to
1d361b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but hard to tell without running the code.
Yep this is actually slowing down things, especially the guessing part. It is there mainly for showing what is possible with some magic (aka - stack trace string parsing). I was able to get Clojure-like stack traces 😄 |
This patch follows some guidelines from Planck and aims at improving source map
consumption in lumo.
The first step was to enable source maps in case of a "load form" (require, ...)
and to refactor
make-eval-opts
so that it can be reused inrepl.cljs
. After that the:source-maps
key needs to be passed to thecljs.stacktrace
machinery for mapping. Additionally, we patch every instance of<embedded>
in stacktrace entries so that we can read from the bundledmain.js.map
file the mapping.This patch changes this:
To this:
A couple of glitches in ClojureScript where identified and fixed (CLJS-2492 and CLJS-2493) so probably some parts will evolve more in the future but this is mapping fine now! 🎉 👍 🥇
Note that the loading of
main.js.map
is onerous the first time that it is done and the patching should be considered an experimental feature.Also big thanks to @mfikes for doing the custom parsing and demunging for planck.