status of source maps support? (+ seems to have broken "run in browser"?)

32 views
Skip to first unread message

Darren Cruse

unread,
Mar 2, 2015, 1:57:21 PM3/2/15
to lispy...@googlegroups.com
I wanted to try source maps with lispyscript - I noticed they were mentioned in the master branch code on github.

But then I realized "npm install" had given me different code than what github master has.

But I went ahead and pulled down master and source maps did work for me.

Well sort of - am I right that maybe the browsers themselves are still working out making source maps work well?

In firefox built-in debugger I could set breakpoints and single step my lispyscript source and it kind of worked reasonably well.

In chrome and IE it would fight you when setting breakpoints while looking at the lispyscript source and more often than not would not set them on the line you were clicking on.  

Or when you could get it to break, when you would try and step it would "jump" instead of going where you'd expect.  In IE that often meant to the last line of the lispyscript file.  In chrome that would often mean into the generated javascript instead of staying in the lispyscript.

Yet the experience of using the source maps with firefox built-in debugger (not firebug btw) was good enough I would use source maps there.  Though I love how simple the mapping is between the generated javascript and the original lispyscript - so I can see you don't *have* to have them.  But I'd like to use them.

Are they close to being published officially as the npm version do you think?

The one thing I noticed though is that when I tried the "running in the browser" example:

It actually gave me an error when using this newer master branch.  It complained that "SourceNode" was undefined.  I might have been doing something stupid - but it seemed like maybe this is the newer source map related code breaking the running in the browser feature?

(on a related note - kind of a dumb question - but could source mapping work when running in the browser with a "text/lispyscript" tag in a web page?  i.e. could the browser single step *lispyscript* embedded in a web page - is that technically feasible?  not that it matters that much - I know "text/lispyscript" is not recommended for production anyway).

Darren

Darren Cruse

unread,
Mar 8, 2015, 1:52:59 PM3/8/15
to lispy...@googlegroups.com
Again for anyone following along..

fyi (re the lack of mailing list responses) I'd corresponded with Santosh on the side and he was very nice and explained he's been super busy but hoped the other maintainers might reply as well...

I do have the "run in browser" bug fixed on my machine it was just a small omission where SourceNode was not being required on the browser (even though it's already available in browser-bundle.js).  No biggie (and after all this was only broken in master and master isn't published on npm yet).

Regarding the source map stuff I did play with it more - the good news is using them with node-inspector for lispyscript files running in node actually seemed to work a little better for me.

But otherwise I'm truthfully a little frustrated with them in the browsers.  And I'm a still uncertain if they're acting poorly due to a problem in how they're implemented in lispyscript master or if the state of source map support really is this poor (I honestly haven't used source maps much in general).

I did find this neat tool that lets you visually inspect source maps btw:  http://sokra.github.io/source-map-visualization/#custom
And I used that on the source maps being generated by lispyscript master (you do "lispy -m") and - they look pretty good!
So I don't know why they don't work better than they do in the browser...

Regarding my other question above about whether even "run in browser" could let you step the lispyscript source I found this:
http://kybernetikos.github.io/jsSandbox/srcmaps/dynamic.html

It shows an example (he happened to use CoffeeScript) of stepping source that was eval'ed in the browser which does seem to work.
And I spent a bunch of time trying to get that to work with lispyscript and it tried to work a little - but not very much. :)

In the end the frustration with source maps, plus the simplicity and brevity of the lispyscript code - makes me wonder if there's not value in going "old school".,,
And e.g. for starters getting the lispyscript REPL running in the browser?
e.g. I notice the code for the lispyscript REPL is pretty short but it relies on "readline" (which I believe is a server-side node thing yes?)
But here's a version of readline for the browser:  http://sdether.github.io/josh.js/

So with this shouldn't it be possible to wind up with a lispyscript written web page that when you want to debug...
There could maybe be an option to pop up a little REPL right there on the page to inspect or change things by typing in lispyscript (as opposed to javascript).
Maybe this would be the first step towards an IDE/debugger not dependent on source maps.
(towards basically acting liking a lispyscript interpreter running in the browser for development, distinct from the compiled/transpiled javascript output for production).
 
Now if only I was as fast at implementing my crazy ideas as I am at dreaming them up. :) 
Reply all
Reply to author
Forward
0 new messages