@samitouri / QOS-React-2 / commits / fc3a3801de

Add support for inline sourcemaps in jsx executable

--source-map-inline

Paul O’Shannessy committed Jul 12, 2014 at 19:30 UTC fc3a3801decac89bcc957aa79efc319e6cf60205
2 files changed +10 -9
bin/jsx
+9 -9
@@ -2,8 +2,7 @@
2 // -*- mode: js -*-
3 "use strict";
4
5 -var visitors = require('../vendor/fbtransform/visitors');
6 -var transform = require('jstransform').transform;
5 +var transform = require('../main').transform;
6
7 require('commoner').version(
8 require('../package.json').version
@@ -12,13 +11,14 @@ require('commoner').version(
11 }).option(
12 '--harmony',
13 'Turns on JS transformations such as ES6 Classes etc.'
14 +).option(
15 + '--source-map-inline',
16 + 'Embed inline sourcemap in transformed source'
17 ).process(function(id, source) {
18 // This is where JSX, ES6, etc. desugaring happens.
17 - var visitorList;
18 - if (this.options.harmony) {
19 - visitorList = visitors.getAllVisitors();
20 - } else {
21 - visitorList = visitors.transformVisitors.react;
22 - }
23 - return transform(visitorList, source).code;
19 + var options = {
20 + harmony: this.options.harmony,
21 + sourceMap: this.options.sourceMapInline
22 + };
23 + return transform(source, options);
24 });
npm-react-tools/README.md
+1
@@ -26,6 +26,7 @@ This package installs a `jsx` executable that can be used to transform JSX into
26 --source-charset <utf8 | win1252 | ...> Charset of source (default: utf8)
27 --output-charset <utf8 | win1252 | ...> Charset of output (default: utf8)
28 --harmony Turns on JS transformations such as ES6 Classes etc.
29 + --source-map-inline Embed inline sourcemap in transformed source
30
31 ## API
32