Commit Graph

23 Commits

Author SHA1 Message Date
Paul O’Shannessy
d2fe87892d Remove transforms from repo, react-tools
Time to just use jstransform.
2015-05-05 10:51:51 -07:00
Paul O’Shannessy
c4a2e4d414 Fix module option parsing of jsx command 2015-03-11 14:26:51 -07:00
Paul O’Shannessy
d40be68d2c Expose --target flag on jsx executable
Valid values are 'es3' and 'es5'.
es3: perform reserved words quoting, don't use defineProperty
es5: default, don't do the above, class methods non-enumerable
2015-02-20 13:37:42 -08:00
Paul O’Shannessy
c889f409bf Merge pull request #3191 from zpao/jsxtransformer-use-shared-code
Use same pathways for browser transforms as we use in react-tools
2015-02-19 16:09:41 -08:00
Paul O’Shannessy
112f7aa249 Move option parsing into react-tools proper.
We were doing some preprocessing for module options in the command line. Since
we also expose the same API via react-tools (and JSXTransformer), we need to do
the same processing from the API. So just move it all to the same place.
2015-02-19 09:46:25 -08:00
Paul O’Shannessy
0e0a8f65c5 Use same pathways for browser transforms as we use in react-tools
This makes sure we can use the same options everywhere, even from react-rails,
without having to specify each one separately in JSXTransformer as well.
2015-02-18 21:40:16 -08:00
Oiva Eskola
35e24759f1 fix sourcemap filenames when using transformWithDetails. Fixes #3140 2015-02-16 22:21:51 +02:00
chico
1511fff598 eslint 2015-02-13 02:43:42 +03:00
Gabe Levi
0d308add09 Update stripTypes transform to use fixed up jstransform transform 2014-11-14 18:25:11 -08:00
jeffmo
808730df59 Add support for a --strip-types flag to bin/jsx 2014-09-05 16:28:46 -04:00
Anthony van der Hoorn
8c1ce8f9c3 Update sourceMap to return .toJSON() output
This means we get a data object back rather than a SourceMapGenerator
2014-07-11 08:44:02 -04:00
Anthony van der Hoorn
b8582b8d1c Refactor transformAsObject to transformWithDetails
This matches current best thinking.
2014-07-11 08:38:28 -04:00
Anthony van der Hoorn
5c4e451054 Abstracted out common code into innerTransform
As per feedback brought common logic from both `transform` and `transformAsObject` into its own `innerTransform` function.
2014-07-06 16:23:50 -04:00
Anthony van der Hoorn
4ecde425f9 Update React-tools to support transform as object
This change adds an additional function to the exported object to support getting access to the transformed result as an object rather than just a string result - the separate function designed to maintain backwards compatibility. 

This facilitates tools that want the code separate from the sourcemap or anything else as time goes by.
2014-07-03 08:20:55 -04:00
Ben Alpert
8a6e2cde7f Don't export (undefined) React in main.js
Previously, this was throwing an error. It was unintentionally (I assume) introduced in fc5bb9c.

Test Plan: jest
2014-06-19 11:34:50 -07:00
Andrew Davey
2b38795769 Rebased on master 2014-05-18 17:51:14 +01:00
Andrew Davey
fc5bb9c9b2 Add sourceMap option to react-tools transform
Allow tools like grunt-react to include inline source maps in the
generated JavaScript. Browserify can then combine these source maps when
bundling everything together.

Usage:

```
var transform = require('react-tools').transform;
var output = transform(jsxContent, {
  sourceMap: true,
  sourceFilename: 'source.jsx'
});
```

The `output` will have an inline source map comment appended.
2014-05-18 17:42:35 +01:00
Christopher Chedeau
5106b793f7 Add support for {harmony: true} to react-tools
```
require('react-tools').transform(code, {harmony: true});
```

now enables all the harmony es6 transforms that are supported.

This is modeled after https://github.com/facebook/react/blob/master/bin/jsx#L17-L23
2014-03-16 15:38:40 -07:00
Paul O’Shannessy
d00b11ef03 Remove React from react-tools package
All of this is provided by the react package now, so there's no point in having
it available in multiple places. We *may* go back on that in the future for
shipping test utils, but for the time being, this is better for all.
2014-02-07 13:59:19 -08:00
JeffMo
2d048f1f34 Move to using jstransform and esprima-fb npm modules 2013-08-22 15:28:41 -07:00
Paul O’Shannessy
0c6bbf275b Ship CJS modules instead of browserified build
It turns out that if you try to browserify a file requiring react-tools,
it doesn't work. This is because browserify just visits the require
statements in the file and looks for files in that path.
./ReactCompositeComponent doesn't exist and that's the point that fails.
So the fix is to actually ship each of our CJS modules as individual
files like browserify expects. This should have no negative side effects
- we still only export React (though the rest of our modules are now
actually accessible, which might make it easier to do more with the
module).

The other change here is to move source-map to dependencies since it's
required in the transform code.

Test Plan:

```
$ npm pack .
$ cd /tmp
$ npm install path/to/react-tools-0.3.1.tgz
$ echo "require('react-tools')" > test.js
$ browserify test.js
```
2013-05-31 10:57:40 -07:00
Paul O’Shannessy
4f7380c4d7 Fix react-tools module
I messed this up pretty badly and didn't include react *at all*.

Test Plan: npm pack && npm install <packed.tgz>, then require('react-tools')`
2013-05-29 21:20:04 -07:00
Paul O’Shannessy
75897c2dcd Initial public release 2013-05-29 12:54:02 -07:00