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

Releases: gaearon/babel-plugin-react-transform

v2.0.2

05 Mar 01:29
Compare
Choose a tag to compare
  • Fixes an issue when a bad polyfill breaks Array#find (#73, 6bb8c60). Thanks Lodash.

v2.0.1

04 Mar 18:42
Compare
Choose a tag to compare
  • Fixes many false positives. Now only wraps components that both have a render method and either subclass one of options.superClasses (by default Component or React.Component) or are created with one of the options.factoryMethods (by default React.createClass). (#86, #84, gaearon/react-transform-catch-errors#25, #81, #78)

v1.1.1

24 Sep 17:23
Compare
Choose a tag to compare

v1.1.0

23 Sep 23:53
Compare
Choose a tag to compare

New Format

We have changed the config format a little bit.

Let's take this example from 1.0.x:

{
  "plugins": ["react-transform"],
  "extra": {
    "react-transform": [{
      "target": "xxx"
    }, {
      "target": "yyy"
    }]
  }
}

Now we're introducing a new config format:

  1. The target option inside every transform configuration object was renamed to transform.
  2. The array of transforms is now a property called transforms on an object.

Here's how the same config would look like after the changes:

{
  "plugins": ["react-transform"],
  "extra": {
    "react-transform": {
      "transforms": [{
        "transform": "xxx"
      }, {
        "transform": "yyy"
      }]
    }
  }
}

The locals and imports stay right where they were—it's just they're next to transform key now instead of a target key:

{
  "plugins": ["react-transform"],
  "extra": {
    "react-transform": {
      "transforms": [{
        "transform": "react-transform-hmr",
        "imports": ["react"],
        "locals": ["module"]
      }, {
        "transform": "react-transform-catch-errors",
        "imports": ["react", "redbox-react"]
      }]
    }
  }
}

That's it! The old format still works (which is why this isn't a breaking change), but prints a warning.

New Features

We didn't introduce a new format without a reason. Now there's a place for a plugin-wide configuration options, unrelated to the specific transform. The first such option, called factoryMethods, ships today, contributed by Aaron Jensen.

If you're not comfortable with ES6 classes and use a custom helper like React.createClass, previously this Babel plugin couldn't find such React components. Now, you can specify a configuration like this:

{
  "plugins": ["react-transform"],
  "extra": {
    "react-transform": {
      "transforms": [/* ... */],

      // here's the new stuff!
      "factoryMethods": ["React.createClass", "createClass", "myCustomFactoryMethod"]

    },
  }
}

This option is not required to specify and can be safely omitted, but can be useful if you prefer custom factory methods or component wrapper functions.

Enjoy!

v1.0.5

17 Sep 00:47
Compare
Choose a tag to compare
  • Remove accidental junk files in NPM release

v1.0.4

16 Sep 19:50
Compare
Choose a tag to compare
  • Allow empty transform options (#14)

v1.0.3

04 Sep 19:07
Compare
Choose a tag to compare
  • Node 0.10 compatibility (#11)

v1.0.2

03 Sep 15:10
Compare
Choose a tag to compare
  • Skip transforms for the files defining imports supplied to them

    For example,

      {
        "target": "react-transform-catch-errors",
        "imports": ["react", "./src/Error"]
      }

    will now skip react-transform-catch-errors for ./src/Error to avoid a circular import.

v1.0.1

03 Sep 00:01
Compare
Choose a tag to compare
  • Fix option names that were broken after renaming. Now the .babelrc option is called react-transform.

v1.0.0

02 Sep 23:32
Compare
Choose a tag to compare
  • Initial release after the rename