Move jsx_whitespace_transform

Also add readme and more details to package.json so it can be published.
This commit is contained in:
Paul O’Shannessy
2014-02-13 15:58:19 -08:00
parent 1012b2ff4b
commit d1a337b9db
7 changed files with 57 additions and 10 deletions

View File

@@ -1,10 +0,0 @@
{
"name": "jsx_whitespace_transformer",
"version": "1.0.0",
"dependencies": {
"esprima-fb": "~2001.1001.0-dev-harmony-fb",
"jstransform": "~2.0.1",
"node-find-files": "0.0.2",
"optimist": "~0.6.0"
}
}

View File

@@ -0,0 +1,40 @@
# JSX Whitespace Transformer
React 0.9 changes the way whitespace is parsed from JSX.
Take this example block:
```js
<div>
Monkeys:
<input type="text" />
</div>
```
In 0.8 and below, this would be transformed to the following:
```js
React.DOM.div(null,
" Monkeys: ",
React.DOM.input( {type:"text"} )
)
```
In 0.9, this will instead be transformed the following:
```js
React.DOM.div(null,
"Monkeys:",
React.DOM.input( {type:"text"} )
)
```
## Usage
The `jsx_whitespace_transformer` module ships an executable which transforms a file or directory of files. It looks for the `@jsx React.DOM` trigger, the same as the `jsx` transformer works. Files will be modified in place, so be sure you are prepared for that.
```sh
$ npm -g install jsx_whitespace_transformer
$ jsx_whitespace_tranformer <path_to_file_or_files>
```

View File

@@ -0,0 +1,17 @@
{
"name": "jsx_whitespace_transformer",
"description": "A utility to update your JSX to behave identically in React 0.8 and React 0.9.",
"version": "1.0.0",
"main": "run.js",
"dependencies": {
"esprima-fb": "~2001.1001.0-dev-harmony-fb",
"jstransform": "~2.0.1",
"node-find-files": "0.0.2",
"optimist": "~0.6.0"
},
"bin": {
"jsx_whitespace_transformer": "./run.js"
},
"license": "Apache-2.0",
"preferGlobal": true
}