jstransformer icon indicating copy to clipboard operation
jstransformer copied to clipboard

What about source maps?

Open aMarCruz opened this issue 8 years ago • 8 comments

There is something intended to support sourcemaps in JSTransformer?

aMarCruz avatar Oct 26 '16 15:10 aMarCruz

They aren't officially supported as far as I'm aware. I suppose nothing prevents a JSTransformer from outputting an inline sourcemap with the result.

RyanZim avatar Oct 26 '16 15:10 RyanZim

@RyanZim make sense, thanks.

aMarCruz avatar Oct 26 '16 15:10 aMarCruz

Which SourceMaps are you looking for? For which engine? Transformers can compile to an object with body, dependencies. It could return any additional options, perhaps.

RobLoach avatar Nov 04 '16 14:11 RobLoach

@RobLoach True, hadn't thought of that.

RyanZim avatar Nov 04 '16 16:11 RyanZim

Interested in this with webpack, since it saves other things directly to the filesystem too.

RobLoach avatar Nov 04 '16 16:11 RobLoach

I would really like to get this implemented.

@jstransformers/core should we output the source map in a sourceMap property in the output object?

var coffee = require('jstransformer')(require('jstransformer-coffee'))
coffee.render('n = 42', {bare: true}).sourceMap
//=> sourcemap...

If this looks good, I may get to beginning an implementation this weekend

calebeby avatar Dec 06 '16 03:12 calebeby

I think the convention is .map but I don't see a reason not to.

TimothyGu avatar Dec 06 '16 07:12 TimothyGu

I'm for .map too. The only one thing needed (and that is our job) is that we should add convert-source-map package and just extract the inline sourcemap if exists.

This part of the start-browserify/index.js#L43-L46 that I built today is just enough here too.

edit: reminder when is implemented: update the rollup transformer

tunnckoCore avatar Jan 01 '17 00:01 tunnckoCore