New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI: Generate source map when running file directly too #3187
Comments
I don't think that the Coffee binary should be spitting out source maps to disk while executing your file ... but we should try to get the best source map support possible in Node. Ideally, as that currently means evaluating the compiled JavaScript in-memory (we don't write out temporary JS files to disk either) ... we'd also be able to pass the corresponding source map to Node, alongside the eval. Anyone have any bright ideas? |
The current version of cs on NPM (tagged 1.6.3) currently generates source maps by default. https://github.com/jashkenas/coffee-script/blob/1.6.3/src/coffee-script.coffee#L87 It's been removed in master, is NPM due for an update? Is there another stable release on it's way? Apologies for the thread highjacking, I didn't want to make another non-issue--issue. |
@startswithaj http://coffeescript.org/
So this should be possible?! |
If source maps can indeed be in memory, that'd be killer. If not, @jashkenas, what would you say to the idea of outputting them into a system temp directory? |
In memory would be much, much preferred. Cross-platform tempfiles are no fun, because Windows. |
Would absolutely 💖 this. I'm working on adding support to hubot for debugging scripts, and currently we only get the compiled javascript. It's better than nothing of course, but would be a game changer for hubot development. |
I've just hacked something together to scratch my itch, I'd also love to see this supported out of the box. |
Nice, @benjie! Thanks. =) |
@benjie: Do you know if this helps with debugging also? E.g. with node-inspector. Perhaps that's a question for the source-map-support module? (cc @evanw) |
@aseemk I haven't tried. Would be awesome if it did though - it would make sense for source-map-support to handle this as you say. |
In memory source maps would be cool feature +1 |
If |
Really terrific work on source maps so far. I'm finally trying it out for the first time, and it's so cool! =)
I tend to run CoffeeScript mostly on the server-side / with Node.js, rather than in the browser. There exists the equally awesome node-inspector for debugging server-side code, and StrongLoop recently added source maps support to it as well.
However, I tend to run server-side CoffeeScript with the
coffee
binary directly, rather than compiling it to JS first, and unfortunately CoffeeScript doesn't support outputting a source map file when running code directly right now.Is this something y'all would be open to supporting? Example use case:
Thanks for the consideration!
Implementation notes:
Running a file directly means ultimately compiling it on the fly via a
require()
hook.CoffeeScript 1.6.3 does/did at least generate a source map on such on-the-fly compiles:
https://github.com/jashkenas/coffee-script/blob/1.6.3/src/coffee-script.coffee#L145-L157
It just didn't output it anywhere.
However, that source map generation was removed after 1.6.3:
3d761e7
So perhaps the best solution would be to keep the latest behavior by default, but support generating and outputting the map if a
--map
argument was given.This would, however, necessitate a change in the CLI, which currently only runs the given file if no options are given.
The text was updated successfully, but these errors were encountered: