-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support
.babel.(jsx|tsx)
extensions
- Loading branch information
Showing
9 changed files
with
111 additions
and
0 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
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 @@ | ||
{ | ||
"presets": ["@babel/preset-react"], | ||
} |
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,7 @@ | ||
{ | ||
"dependencies": { | ||
"@babel/core": "^7.2.2", | ||
"@babel/preset-react": "^7.0.0", | ||
"@babel/register": "^7.0.0" | ||
} | ||
} |
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,17 @@ | ||
const React = { | ||
createElement: function (Component) { | ||
return Component(); | ||
} | ||
}; | ||
|
||
// Test harmony arrow functions | ||
const Component = () => { | ||
var trueKey = true; | ||
var falseKey = false; | ||
var subKey = { subProp: 1 }; | ||
// Test harmony object short notation | ||
return { data: { trueKey, falseKey, subKey } }; | ||
}; | ||
|
||
// Test JSX syntax | ||
module.exports = <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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"presets": [ | ||
"@babel/preset-env", | ||
"@babel/preset-react", | ||
[ | ||
"@babel/preset-typescript", | ||
{ | ||
"isTSX": true, | ||
"allExtensions": true | ||
} | ||
] | ||
] | ||
} |
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,19 @@ | ||
var test: { | ||
data: { | ||
trueKey: boolean, | ||
falseKey: boolean, | ||
subKey: { | ||
subProp: number | ||
} | ||
} | ||
} = { | ||
data: { | ||
trueKey: true, | ||
falseKey: false, | ||
subKey: { | ||
subProp: 1 | ||
} | ||
} | ||
} | ||
|
||
export default test |
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 @@ | ||
{ | ||
"dependencies": { | ||
"@babel/core": "^7.2.2", | ||
"@babel/preset-env": "^7.2.3", | ||
"@babel/preset-react": "^7.0.0", | ||
"@babel/preset-typescript": "^7.1.0", | ||
"@babel/register": "^7.0.0" | ||
} | ||
} |
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,20 @@ | ||
import data from "./data.babel" | ||
|
||
const React = { | ||
createElement(Component: () => any) { | ||
return Component() | ||
} | ||
} | ||
|
||
// Test harmony arrow functions. | ||
const Component = () => { | ||
var trueKey: boolean = true | ||
var falseKey: boolean = false | ||
var subKey = { subProp: 1 } | ||
|
||
// Test harmony object short notation. | ||
return { data: { trueKey, falseKey, subKey } } | ||
} | ||
|
||
// Test TSX syntax. | ||
export default <Component {...data} /> |
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