Commit Graph

10 Commits

Author SHA1 Message Date
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