This repository has been archived by the owner on Apr 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from nfcampos/master
Only wrap descendants with render method, closes #84
- Loading branch information
Showing
56 changed files
with
549 additions
and
384 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 6 additions & 26 deletions
32
test/fixtures/code-call-expression-with-render-method/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,11 @@ | ||
import _transformLib from 'transform-lib'; | ||
const _components = { | ||
_component: {}, | ||
_component2: {}, | ||
_component3: {} | ||
}; | ||
|
||
const _transformLib2 = _transformLib({ | ||
filename: '%FIXTURE_PATH%', | ||
components: _components, | ||
locals: [], | ||
imports: [] | ||
}); | ||
|
||
function _wrapComponent(id) { | ||
return function (Component) { | ||
return _transformLib2(Component, id); | ||
}; | ||
} | ||
|
||
_wrapComponent('_component')(factory({ | ||
factory({ | ||
render() {} | ||
})); | ||
}); | ||
|
||
_wrapComponent('_component2')(factory({ | ||
factory({ | ||
render: function () {} | ||
})); | ||
}); | ||
|
||
_wrapComponent('_component3')(factory({ | ||
factory({ | ||
'render': function () {} | ||
})); | ||
}); |
9 changes: 9 additions & 0 deletions
9
test/fixtures/code-class-expression-extends-react-component-with-render-method/.babelrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"plugins": [ | ||
["../../../src", { | ||
"transforms": [{ | ||
"transform": "transform-lib" | ||
}] | ||
}] | ||
] | ||
} |
6 changes: 6 additions & 0 deletions
6
test/fixtures/code-class-expression-extends-react-component-with-render-method/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
foo(class Foo extends React.Component { | ||
render() {} | ||
}); | ||
foo(class extends React.Component { | ||
render() {} | ||
}); |
27 changes: 27 additions & 0 deletions
27
test/fixtures/code-class-expression-extends-react-component-with-render-method/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
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 { | ||
render() {} | ||
})); | ||
foo(_wrapComponent("_component")(class extends React.Component { | ||
render() {} | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,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 {}); |
9 changes: 9 additions & 0 deletions
9
test/fixtures/code-class-extends-component-with-render-method/.babelrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"plugins": [ | ||
["../../../src", { | ||
"transforms": [{ | ||
"transform": "transform-lib" | ||
}] | ||
}] | ||
] | ||
} |
4 changes: 4 additions & 0 deletions
4
test/fixtures/code-class-extends-component-with-render-method/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import React, { Component } from 'react'; | ||
class Foo extends Component { | ||
render() {} | ||
} |
25 changes: 25 additions & 0 deletions
25
test/fixtures/code-class-extends-component-with-render-method/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
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); | ||
}; | ||
} | ||
|
||
import React, { Component } from 'react'; | ||
|
||
const Foo = _wrapComponent('Foo')(class Foo extends Component { | ||
render() {} | ||
}); |
9 changes: 9 additions & 0 deletions
9
test/fixtures/code-class-extends-react-component-with-render-method/.babelrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"plugins": [ | ||
["../../../src", { | ||
"transforms": [{ | ||
"transform": "transform-lib" | ||
}] | ||
}] | ||
] | ||
} |
3 changes: 3 additions & 0 deletions
3
test/fixtures/code-class-extends-react-component-with-render-method/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Foo extends React.Component { | ||
render() {} | ||
} |
23 changes: 23 additions & 0 deletions
23
test/fixtures/code-class-extends-react-component-with-render-method/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
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 { | ||
render() {} | ||
}); |
22 changes: 1 addition & 21 deletions
22
test/fixtures/code-class-extends-react-component/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +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 {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,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); | ||
}; | ||
} | ||
|
||
const Foo = _wrapComponent("Foo")(class Foo { | ||
class Foo { | ||
render() {} | ||
}); | ||
} |
9 changes: 9 additions & 0 deletions
9
test/fixtures/code-class-within-function-extends-react-component-with-render-method/.babelrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"plugins": [ | ||
["../../../src", { | ||
"transforms": [{ | ||
"transform": "transform-lib" | ||
}] | ||
}] | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
.../fixtures/code-class-within-function-extends-react-component-with-render-method/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function factory() { | ||
return class Foo extends React.Component { | ||
render() {} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...ixtures/code-class-within-function-extends-react-component-with-render-method/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
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 { | ||
render() {} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,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 {}; | ||
} |
9 changes: 9 additions & 0 deletions
9
test/fixtures/code-class-without-name-extends-react-component-with-render-method/.babelrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"plugins": [ | ||
["../../../src", { | ||
"transforms": [{ | ||
"transform": "transform-lib" | ||
}] | ||
}] | ||
] | ||
} |
3 changes: 3 additions & 0 deletions
3
test/fixtures/code-class-without-name-extends-react-component-with-render-method/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const Foo = class extends React.Component { | ||
render() {} | ||
} |
21 changes: 21 additions & 0 deletions
21
test/fixtures/code-class-without-name-extends-react-component-with-render-method/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
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 { | ||
render() {} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +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 {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.