Skip to content

Commit

Permalink
Add support for inline sourcemaps in jsx executable
Browse files Browse the repository at this point in the history
--source-map-inline
  • Loading branch information
zpao committed Jul 13, 2014
1 parent 87c8e69 commit fc3a380
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
18 changes: 9 additions & 9 deletions bin/jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// -*- mode: js -*-
"use strict";

var visitors = require('../vendor/fbtransform/visitors');
var transform = require('jstransform').transform;
var transform = require('../main').transform;

require('commoner').version(
require('../package.json').version
Expand All @@ -12,13 +11,14 @@ require('commoner').version(
}).option(
'--harmony',
'Turns on JS transformations such as ES6 Classes etc.'
).option(
'--source-map-inline',
'Embed inline sourcemap in transformed source'
).process(function(id, source) {
// This is where JSX, ES6, etc. desugaring happens.
var visitorList;
if (this.options.harmony) {
visitorList = visitors.getAllVisitors();
} else {
visitorList = visitors.transformVisitors.react;
}
return transform(visitorList, source).code;
var options = {
harmony: this.options.harmony,
sourceMap: this.options.sourceMapInline
};
return transform(source, options);
});
1 change: 1 addition & 0 deletions npm-react-tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ This package installs a `jsx` executable that can be used to transform JSX into
--source-charset <utf8 | win1252 | ...> Charset of source (default: utf8)
--output-charset <utf8 | win1252 | ...> Charset of output (default: utf8)
--harmony Turns on JS transformations such as ES6 Classes etc.
--source-map-inline Embed inline sourcemap in transformed source

## API

Expand Down

0 comments on commit fc3a380

Please sign in to comment.