Add a 'throwIfNamespace' option for JSX transform (#6563)
* Added tests for ifThrowNamespace flag * JSX transformator could work with XMLNamespaces (ifThrowNamespace flag) * Use template literal instead * Attempt to reword the message * Added docs * Reworded docs * Reworded docs * Fixed missing space in error message
This commit is contained in:
@@ -3,6 +3,8 @@ import helper from "@babel/helper-builder-react-jsx";
|
||||
|
||||
export default function({ types: t }, options) {
|
||||
const pragma = options.pragma || "React.createElement";
|
||||
const throwIfNamespace =
|
||||
options.throwIfNamespace === undefined ? true : !!options.throwIfNamespace;
|
||||
|
||||
const JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/;
|
||||
|
||||
@@ -20,6 +22,8 @@ export default function({ types: t }, options) {
|
||||
post(state, pass) {
|
||||
state.callee = pass.get("jsxIdentifier")();
|
||||
},
|
||||
|
||||
throwIfNamespace,
|
||||
});
|
||||
|
||||
visitor.Program = function(path, state) {
|
||||
|
||||
Reference in New Issue
Block a user