Fix regression that leaks JSX pragma config between files. (#6519)

This commit is contained in:
Logan Smyth
2017-10-19 16:09:56 -07:00
committed by GitHub
parent fc75198fb4
commit 765e920e48

View File

@@ -2,8 +2,7 @@ import jsx from "@babel/plugin-syntax-jsx";
import helper from "@babel/helper-builder-react-jsx";
export default function({ types: t }, options) {
const { pragma } = options;
let id = pragma || "React.createElement";
const pragma = options.pragma || "React.createElement";
const JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/;
@@ -26,6 +25,7 @@ export default function({ types: t }, options) {
visitor.Program = function(path, state) {
const { file } = state;
let id = pragma;
for (const comment of (file.ast.comments: Array<Object>)) {
const matches = JSX_ANNOTATION_REGEX.exec(comment.value);
if (matches) {