jstransformers / jstransformer

Normalize the API of any JSTransformer.
http://npm.im/jstransformer
MIT License
153 stars 12 forks source link

What about source maps? #170

Open aMarCruz opened 7 years ago

aMarCruz commented 7 years ago

There is something intended to support sourcemaps in JSTransformer?

RyanZim commented 7 years ago

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.

aMarCruz commented 7 years ago

@RyanZim make sense, thanks.

RobLoach commented 7 years ago

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.

RyanZim commented 7 years ago

@RobLoach True, hadn't thought of that.

RobLoach commented 7 years ago

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

calebeby commented 7 years ago

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

TimothyGu commented 7 years ago

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

tunnckoCore commented 7 years ago

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