mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-08-02 02:38:53 -04:00
Fixed issues with JSX.createElement definitions
This commit is contained in:
@@ -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 */
|
||||
|
||||
@@ -70,7 +70,7 @@ export default (gulp, config, args) => {
|
||||
|
||||
/* Provide JSX helper */
|
||||
new webpack.ProvidePlugin({
|
||||
JSX: path.join(process.cwd(), `${config.lib}/providers/jsx.js`)
|
||||
Jsx: path.join(process.cwd(), `${config.lib}/providers/jsx.js`)
|
||||
})
|
||||
].concat(
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ const format = eslint.getFormatter()
|
||||
|
||||
export default (gulp, config) => {
|
||||
return () => {
|
||||
return gulp.src(`${config.assets.src}/javascripts/**/*.js`)
|
||||
return gulp.src(`${config.assets.src}/javascripts/**/*.{js,jsx}`)
|
||||
|
||||
/* Linting */
|
||||
.pipe(
|
||||
|
||||
Reference in New Issue
Block a user