Fixed issues with JSX.createElement definitions

This commit is contained in:
squidfunk
2017-02-25 14:49:49 +01:00
parent 7908140dc5
commit 672a39b697
39 changed files with 490 additions and 11627 deletions

View File

@@ -20,6 +20,7 @@
* IN THE SOFTWARE.
*/
import { transform } from "babel-core"
import jsdoc2flow from "flow-jsdoc"
import through from "through2"
@@ -37,9 +38,18 @@ export default (gulp, config) => {
if (file.isNull() || file.isStream())
return done()
/* Perform Babel transformation to resolve JSX calls */
const transformed = transform(file.contents.toString(), {
plugins: [
["transform-react-jsx", {
"pragma": "Jsx.createElement"
}]
]
})
/* Annotate contents */
file.contents = new Buffer(jsdoc2flow(
`/* @flow */\n\n${file.contents.toString()}`
`/* @flow */\n\n${transformed.code}`
).toString())
/* Push file to next stage */