babel-plugin-react-transform
Advanced tools
Comparing version 2.0.0-beta1 to 2.0.0
@@ -225,3 +225,11 @@ 'use strict'; | ||
return t.objectProperty(t.identifier(componentId), t.objectExpression(componentProps)); | ||
var objectKey = undefined; | ||
if (t.isValidIdentifier(componentId)) { | ||
objectKey = t.identifier(componentId); | ||
} else { | ||
objectKey = t.stringLiteral(componentId); | ||
} | ||
return t.objectProperty(objectKey, t.objectExpression(componentProps)); | ||
}); | ||
@@ -228,0 +236,0 @@ |
{ | ||
"name": "babel-plugin-react-transform", | ||
"version": "2.0.0-beta1", | ||
"version": "2.0.0", | ||
"description": "Babel plugin to instrument React components with custom transforms", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -0,4 +1,9 @@ | ||
> These docs are for the v2 release using Babel 6, if you are still on Babel 5 then you should use | ||
> v1.1 instead. | ||
> | ||
> View the `v1.1` docs [here](https://github.com/gaearon/babel-plugin-react-transform/tree/v1.1.1) | ||
# babel-plugin-react-transform | ||
[![react-transform channel on slack](https://img.shields.io/badge/slack-react--transform%40reactiflux-61DAFB.svg?style=flat-square)](http://www.reactiflux.com) | ||
[![react-transform channel on discord](https://img.shields.io/badge/discord-react--transform%40reactiflux-61DAFB.svg?style=flat-square)](http://www.reactiflux.com) | ||
@@ -95,3 +100,3 @@ :rocket: **Now with [Babel 6](https://github.com/babel/babel) support** (thank you [@thejameskyle](https://github.com/thejameskyle)!) | ||
Note that when using `React.createClass()` and allowing `babel` to extract the `displayName` property you must ensure that [babel-plugin-react-display-name](https://github.com/babel/babel/tree/development/packages/babel-plugin-react-display-name) is included before `react-transform`. See [this github issue](https://github.com/gaearon/babel-plugin-react-transform/issues/19) for more details. | ||
Note that when using `React.createClass()` and allowing `babel` to extract the `displayName` property you must ensure that [babel-plugin-react-display-name](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-display-name) is included before `react-transform`. See [this github issue](https://github.com/gaearon/babel-plugin-react-transform/issues/19) for more details. | ||
@@ -98,0 +103,0 @@ You may optionally specify an array of strings called `factoryMethods` if you want the plugin to look for components created with a factory method other than `React.createClass`. Note that you don’t have to do anything special to look for ES6 components—`factoryMethods` is only relevant if you use factory methods akin to `React.createClass`. |
@@ -12,2 +12,1 @@ factory({ | ||
}); | ||
@@ -16,5 +16,10 @@ import path from 'path'; | ||
const fixtureDir = path.join(fixturesDir, caseName); | ||
const actualPath = path.join(fixtureDir, 'actual.js'); | ||
let actualPath = path.join(fixtureDir, 'actual.js'); | ||
const actual = transformFileSync(actualPath).code; | ||
if (path.sep === '\\') { | ||
// Specific case of windows, transformFileSync return code with '/' | ||
actualPath = actualPath.replace(/\\/g, '/'); | ||
} | ||
const expected = fs.readFileSync( | ||
@@ -21,0 +26,0 @@ path.join(fixtureDir, 'expected.js') |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
38636
62
699
0
227
0