Skip to content
This repository has been archived by the owner on Apr 9, 2020. It is now read-only.

Commit

Permalink
Fix remaining option name changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Sep 3, 2015
1 parent 8e87f97 commit 762a221
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ npm install --save-dev react-transform-webpack-hmr
npm install --save-dev react-transform-catch-errors
```

Then edit your `.babelrc` to include `extra.babel-plugin-react-transform`.
Then edit your `.babelrc` to include `extra.react-transform`.
It must be an array of the transforms you want to use:

```js
{
"stage": 0,
"plugins": [
"babel-plugin-react-transform"
"react-transform"
],
"extra": {
// must be defined and be an array
"babel-plugin-react-transform": [{
"react-transform": [{
// can be an NPM module name or a local path
"target": "react-transform-webpack-hmr",
// will be available as options.imports to the transform
Expand Down
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function ({ Plugin, types: t }) {
if (specifiedPath[0] === '.') {
throw new Error(
`Relative path like ${specifiedPath} is only allowed if ` +
`babel-plugin-wrap-react-components is inside a node_modules folder.`
`babel-plugin-react-transform is inside a node_modules folder.`
);
}
return specifiedPath;
Expand Down Expand Up @@ -89,11 +89,11 @@ export default function ({ Plugin, types: t }) {
if (!file.opts || !file.opts.extra) {
return;
}
const pluginOptions = file.opts.extra['babel-plugin-wrap-react-components'];
const pluginOptions = file.opts.extra['react-transform'];
if (!Array.isArray(pluginOptions) || pluginOptions.length === 0) {
throw new Error(
'babel-plugin-wrap-react-components requires that you specify ' +
'extras["babel-plugin-wrap-react-components"] in .babelrc ' +
'babel-plugin-react-transform requires that you specify ' +
'extras["react-transform"] in .babelrc ' +
'or in your Babel Node API call options, and that it is an array ' +
'with more than zero elements.'
);
Expand Down Expand Up @@ -211,7 +211,7 @@ export default function ({ Plugin, types: t }) {
);
}

return new Plugin('babel-plugin-wrap-react-components', {
return new Plugin('babel-plugin-react-transform', {
visitor: {
Function: {
enter(node, parent, scope, file) {
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('finds React components', () => {
const actual = transformFileSync(actualPath, {
plugins: [plugin],
extra: {
'babel-plugin-wrap-react-components': [{
'react-transform': [{
target: 'my-custom-module/wrap',
locals: ['module'],
imports: ['react']
Expand Down

0 comments on commit 762a221

Please sign in to comment.