babel-plugin-react-transform
Advanced tools
Comparing version 2.0.0 to 2.0.1
'use strict'; | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,2 +7,6 @@ value: true | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
exports.default = function (_ref) { | ||
@@ -66,3 +68,3 @@ var t = _ref.types; | ||
Class: function Class(path) { | ||
if (path.node[VISITED_KEY] || !matchesPatterns(path.get('superClass'), this.superClasses) && !isReactLikeClass(path.node)) { | ||
if (path.node[VISITED_KEY] || !matchesPatterns(path.get('superClass'), this.superClasses) || !isReactLikeClass(path.node)) { | ||
return; | ||
@@ -105,3 +107,3 @@ } | ||
CallExpression: function CallExpression(path) { | ||
if (path.node[VISITED_KEY] || !matchesPatterns(path.get('callee'), this.factoryMethods) && !isReactLikeComponentObject(path.node.arguments[0])) { | ||
if (path.node[VISITED_KEY] || !matchesPatterns(path.get('callee'), this.factoryMethods) || !isReactLikeComponentObject(path.node.arguments[0])) { | ||
return; | ||
@@ -127,3 +129,3 @@ } | ||
var ReactTransformBuilder = (function () { | ||
var ReactTransformBuilder = function () { | ||
function ReactTransformBuilder(file, options) { | ||
@@ -145,3 +147,3 @@ _classCallCheck(this, ReactTransformBuilder); | ||
factoryMethods: options.factoryMethods || ['React.createClass'], | ||
superClasses: options.superClasses || ['React.Component'], | ||
superClasses: options.superClasses || ['React.Component', 'Component'], | ||
transforms: options.transforms.map(function (opts) { | ||
@@ -326,3 +328,3 @@ return { | ||
return ReactTransformBuilder; | ||
})(); | ||
}(); | ||
@@ -349,4 +351,2 @@ return { | ||
function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
{ | ||
"name": "babel-plugin-react-transform", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Babel plugin to instrument React components with custom transforms", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -6,4 +6,4 @@ # Patrons | ||
* [Webflow](https://webflow.com/) | ||
* [Chess iX](http://www.chess-ix.com/) | ||
* [Webflow](https://github.com/webflow) | ||
* [Ximedes](https://www.ximedes.com/) | ||
* [Herman J. Radtke III](http://hermanradtke.com) | ||
@@ -10,0 +10,0 @@ * [Ken Wheeler](http://kenwheeler.github.io/) |
@@ -219,4 +219,4 @@ > These docs are for the v2 release using Babel 6, if you are still on Babel 5 then you should use | ||
* [Webflow](http://webflow.com/) | ||
* [Chess iX](http://www.chess-ix.com/) | ||
* [Webflow](https://github.com/webflow) | ||
* [Ximedes](https://www.ximedes.com/) | ||
@@ -223,0 +223,0 @@ [See the full list of React Transform patrons.](PATRONS.md) |
@@ -1,31 +0,11 @@ | ||
import _transformLib from 'transform-lib'; | ||
const _components = { | ||
_component: {}, | ||
_component2: {}, | ||
_component3: {} | ||
}; | ||
const _transformLib2 = _transformLib({ | ||
filename: '%FIXTURE_PATH%', | ||
components: _components, | ||
locals: [], | ||
imports: [] | ||
factory({ | ||
render() {} | ||
}); | ||
function _wrapComponent(id) { | ||
return function (Component) { | ||
return _transformLib2(Component, id); | ||
}; | ||
} | ||
_wrapComponent('_component')(factory({ | ||
render() {} | ||
})); | ||
_wrapComponent('_component2')(factory({ | ||
factory({ | ||
render: function () {} | ||
})); | ||
}); | ||
_wrapComponent('_component3')(factory({ | ||
factory({ | ||
'render': function () {} | ||
})); | ||
}); |
@@ -1,23 +0,2 @@ | ||
import _transformLib from "transform-lib"; | ||
const _components = { | ||
Foo: { | ||
displayName: "Foo" | ||
}, | ||
_component: {} | ||
}; | ||
const _transformLib2 = _transformLib({ | ||
filename: "%FIXTURE_PATH%", | ||
components: _components, | ||
locals: [], | ||
imports: [] | ||
}); | ||
function _wrapComponent(id) { | ||
return function (Component) { | ||
return _transformLib2(Component, id); | ||
}; | ||
} | ||
foo(_wrapComponent("Foo")(class Foo extends React.Component {})); | ||
foo(_wrapComponent("_component")(class extends React.Component {})); | ||
foo(class Foo extends React.Component {}); | ||
foo(class extends React.Component {}); |
@@ -1,21 +0,1 @@ | ||
import _transformLib from "transform-lib"; | ||
const _components = { | ||
Foo: { | ||
displayName: "Foo" | ||
} | ||
}; | ||
const _transformLib2 = _transformLib({ | ||
filename: "%FIXTURE_PATH%", | ||
components: _components, | ||
locals: [], | ||
imports: [] | ||
}); | ||
function _wrapComponent(id) { | ||
return function (Component) { | ||
return _transformLib2(Component, id); | ||
}; | ||
} | ||
const Foo = _wrapComponent("Foo")(class Foo extends React.Component {}); | ||
class Foo extends React.Component {} |
@@ -1,23 +0,3 @@ | ||
import _transformLib from "transform-lib"; | ||
const _components = { | ||
Foo: { | ||
displayName: "Foo" | ||
} | ||
}; | ||
const _transformLib2 = _transformLib({ | ||
filename: "%FIXTURE_PATH%", | ||
components: _components, | ||
locals: [], | ||
imports: [] | ||
}); | ||
function _wrapComponent(id) { | ||
return function (Component) { | ||
return _transformLib2(Component, id); | ||
}; | ||
class Foo { | ||
render() {} | ||
} | ||
const Foo = _wrapComponent("Foo")(class Foo { | ||
render() {} | ||
}); |
@@ -1,24 +0,3 @@ | ||
import _transformLib from "transform-lib"; | ||
const _components = { | ||
Foo: { | ||
displayName: "Foo", | ||
isInFunction: true | ||
} | ||
}; | ||
const _transformLib2 = _transformLib({ | ||
filename: "%FIXTURE_PATH%", | ||
components: _components, | ||
locals: [], | ||
imports: [] | ||
}); | ||
function _wrapComponent(id) { | ||
return function (Component) { | ||
return _transformLib2(Component, id); | ||
}; | ||
} | ||
function factory() { | ||
return _wrapComponent("Foo")(class Foo extends React.Component {}); | ||
return class Foo extends React.Component {}; | ||
} |
@@ -1,19 +0,1 @@ | ||
import _transformLib from "transform-lib"; | ||
const _components = { | ||
_component: {} | ||
}; | ||
const _transformLib2 = _transformLib({ | ||
filename: "%FIXTURE_PATH%", | ||
components: _components, | ||
locals: [], | ||
imports: [] | ||
}); | ||
function _wrapComponent(id) { | ||
return function (Component) { | ||
return _transformLib2(Component, id); | ||
}; | ||
} | ||
const Foo = _wrapComponent("_component")(class extends React.Component {}); | ||
const Foo = class extends React.Component {}; |
@@ -6,1 +6,4 @@ export default class Foo extends React.Component {} | ||
export const bar = React.createClass({}); | ||
export default class Baz { render() {} } | ||
export default class { render() {} } | ||
export class Boo { render() {} } |
@@ -1,36 +0,14 @@ | ||
import _transformLib from "transform-lib"; | ||
const _components = { | ||
Foo: { | ||
displayName: "Foo" | ||
}, | ||
_component: {}, | ||
_component2: {}, | ||
Bar: { | ||
displayName: "Bar" | ||
}, | ||
_component3: {} | ||
}; | ||
const _transformLib2 = _transformLib({ | ||
filename: "%FIXTURE_PATH%", | ||
components: _components, | ||
locals: [], | ||
imports: [] | ||
}); | ||
function _wrapComponent(id) { | ||
return function (Component) { | ||
return _transformLib2(Component, id); | ||
}; | ||
export default class Foo extends React.Component {} | ||
export default class extends React.Component {} | ||
export default React.createClass({}); | ||
export class Bar extends React.Component {} | ||
export const bar = React.createClass({}); | ||
export default class Baz { | ||
render() {} | ||
} | ||
const Foo = _wrapComponent("Foo")(class Foo extends React.Component {}); | ||
export default Foo; | ||
const _component = _wrapComponent("_component")(class extends React.Component {}); | ||
export default _component; | ||
export default _wrapComponent("_component2")(React.createClass({})); | ||
export const Bar = _wrapComponent("Bar")(class Bar extends React.Component {}); | ||
export const bar = _wrapComponent("_component3")(React.createClass({})); | ||
export default class { | ||
render() {} | ||
} | ||
export class Boo { | ||
render() {} | ||
} |
@@ -1,21 +0,3 @@ | ||
import _transformLib from "transform-lib"; | ||
const _components = { | ||
_component: {} | ||
}; | ||
const _transformLib2 = _transformLib({ | ||
filename: "%FIXTURE_PATH%", | ||
components: _components, | ||
locals: [], | ||
imports: [] | ||
const Foo = React.createClass({ | ||
displayName: Math.random() | ||
}); | ||
function _wrapComponent(id) { | ||
return function (Component) { | ||
return _transformLib2(Component, id); | ||
}; | ||
} | ||
const Foo = _wrapComponent("_component")(React.createClass({ | ||
displayName: Math.random() | ||
})); |
@@ -1,23 +0,3 @@ | ||
import _transformLib from 'transform-lib'; | ||
const _components = { | ||
'my-component': { | ||
displayName: 'my-component' | ||
} | ||
}; | ||
const _transformLib2 = _transformLib({ | ||
filename: '%FIXTURE_PATH%', | ||
components: _components, | ||
locals: [], | ||
imports: [] | ||
const MyComponent = React.createClass({ | ||
displayName: 'my-component' | ||
}); | ||
function _wrapComponent(id) { | ||
return function (Component) { | ||
return _transformLib2(Component, id); | ||
}; | ||
} | ||
const MyComponent = _wrapComponent('my-component')(React.createClass({ | ||
displayName: 'my-component' | ||
})); |
@@ -1,19 +0,1 @@ | ||
import _transformLib from "transform-lib"; | ||
const _components = { | ||
_component: {} | ||
}; | ||
const _transformLib2 = _transformLib({ | ||
filename: "%FIXTURE_PATH%", | ||
components: _components, | ||
locals: [], | ||
imports: [] | ||
}); | ||
function _wrapComponent(id) { | ||
return function (Component) { | ||
return _transformLib2(Component, id); | ||
}; | ||
} | ||
const Foo = _wrapComponent("_component")(React.createClass({})); | ||
const Foo = React.createClass({}); |
@@ -1,26 +0,5 @@ | ||
import _transformLib from 'transform-lib'; | ||
const _components = { | ||
Foo: { | ||
displayName: 'Foo' | ||
}, | ||
_component: {} | ||
}; | ||
const _transformLib2 = _transformLib({ | ||
filename: '%FIXTURE_PATH%', | ||
components: _components, | ||
locals: [], | ||
imports: [] | ||
const Foo = React.createClass({ | ||
displayName: 'Foo' | ||
}); | ||
function _wrapComponent(id) { | ||
return function (Component) { | ||
return _transformLib2(Component, id); | ||
}; | ||
} | ||
const Foo = _wrapComponent('Foo')(React.createClass({ | ||
displayName: 'Foo' | ||
})); | ||
_wrapComponent('_component')(React.createClass({})); | ||
React.createClass({}); |
@@ -1,30 +0,7 @@ | ||
import _transformLib from 'transform-lib'; | ||
const _components = { | ||
Foo: { | ||
displayName: 'Foo' | ||
}, | ||
Bar: { | ||
displayName: 'Bar' | ||
} | ||
}; | ||
const _transformLib2 = _transformLib({ | ||
filename: '%FIXTURE_PATH%', | ||
components: _components, | ||
locals: [], | ||
imports: [] | ||
const Foo = createClass({ | ||
displayName: 'Foo' | ||
}); | ||
function _wrapComponent(id) { | ||
return function (Component) { | ||
return _transformLib2(Component, id); | ||
}; | ||
} | ||
const Foo = _wrapComponent('Foo')(createClass({ | ||
displayName: 'Foo' | ||
})); | ||
const Bar = _wrapComponent('Bar')(factory({ | ||
const Bar = factory({ | ||
displayName: 'Bar' | ||
})); | ||
}); |
@@ -1,2 +0,2 @@ | ||
class Foo extends Component {} | ||
class Foo extends BooComponent {} | ||
class Bar extends CustomComponent {} |
@@ -1,26 +0,2 @@ | ||
import _transformLib from "transform-lib"; | ||
const _components = { | ||
Foo: { | ||
displayName: "Foo" | ||
}, | ||
Bar: { | ||
displayName: "Bar" | ||
} | ||
}; | ||
const _transformLib2 = _transformLib({ | ||
filename: "%FIXTURE_PATH%", | ||
components: _components, | ||
locals: [], | ||
imports: [] | ||
}); | ||
function _wrapComponent(id) { | ||
return function (Component) { | ||
return _transformLib2(Component, id); | ||
}; | ||
} | ||
const Foo = _wrapComponent("Foo")(class Foo extends Component {}); | ||
const Bar = _wrapComponent("Bar")(class Bar extends CustomComponent {}); | ||
class Foo extends BooComponent {} | ||
class Bar extends CustomComponent {} |
@@ -1,29 +0,1 @@ | ||
import _transformTwo from "transform-two"; | ||
import _transformOne from "transform-one"; | ||
const _components = { | ||
Foo: { | ||
displayName: "Foo" | ||
} | ||
}; | ||
const _transformOne2 = _transformOne({ | ||
filename: "%FIXTURE_PATH%", | ||
components: _components, | ||
locals: [], | ||
imports: [] | ||
}); | ||
const _transformTwo2 = _transformTwo({ | ||
filename: "%FIXTURE_PATH%", | ||
components: _components, | ||
locals: [], | ||
imports: [] | ||
}); | ||
function _wrapComponent(id) { | ||
return function (Component) { | ||
return _transformOne2(_transformTwo2(Component, id), id); | ||
}; | ||
} | ||
const Foo = _wrapComponent("Foo")(class Foo extends React.Component {}); | ||
class Foo extends React.Component {} |
@@ -1,23 +0,1 @@ | ||
import _reactDom from "react-dom"; | ||
import _react from "react"; | ||
import _transformLib from "transform-lib"; | ||
const _components = { | ||
Foo: { | ||
displayName: "Foo" | ||
} | ||
}; | ||
const _transformLib2 = _transformLib({ | ||
filename: "%FIXTURE_PATH%", | ||
components: _components, | ||
locals: [], | ||
imports: [_react, _reactDom] | ||
}); | ||
function _wrapComponent(id) { | ||
return function (Component) { | ||
return _transformLib2(Component, id); | ||
}; | ||
} | ||
const Foo = _wrapComponent("Foo")(class Foo extends React.Component {}); | ||
class Foo extends React.Component {} |
@@ -1,21 +0,1 @@ | ||
import _transformLib from "transform-lib"; | ||
const _components = { | ||
Foo: { | ||
displayName: "Foo" | ||
} | ||
}; | ||
const _transformLib2 = _transformLib({ | ||
filename: "%FIXTURE_PATH%", | ||
components: _components, | ||
locals: [module, exports], | ||
imports: [] | ||
}); | ||
function _wrapComponent(id) { | ||
return function (Component) { | ||
return _transformLib2(Component, id); | ||
}; | ||
} | ||
const Foo = _wrapComponent("Foo")(class Foo extends React.Component {}); | ||
class Foo extends React.Component {} |
Sorry, the diff of this file is not supported yet
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
41207
98
756
1