mirror of
https://github.com/facebook/react.git
synced 2026-02-22 03:42:05 +00:00
Move jsx_whitespace_transform
Also add readme and more details to package.json so it can be published.
This commit is contained in:
@@ -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"
|
||||
}
|
||||
}
|
||||
40
npm-jsx_whitespace_transform/README.md
Normal file
40
npm-jsx_whitespace_transform/README.md
Normal 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>
|
||||
```
|
||||
17
npm-jsx_whitespace_transform/package.json
Normal file
17
npm-jsx_whitespace_transform/package.json
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user