From 4988a27b6c796816e1324b08f61d9ec80fbb5c68 Mon Sep 17 00:00:00 2001 From: ArrestedDevelopment Date: Sat, 28 Mar 2015 01:41:16 -0600 Subject: [PATCH] JSX Transformer: Add 'jsxPragma' option --- src/babel/transformation/file/options.json | 7 +++++++ src/babel/transformation/transformers/other/react.js | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/babel/transformation/file/options.json b/src/babel/transformation/file/options.json index 06f04ef7fe..f84f766c6b 100644 --- a/src/babel/transformation/file/options.json +++ b/src/babel/transformation/file/options.json @@ -83,6 +83,13 @@ "shorthand": "L" }, + "jsxPragma": { + "type": "string", + "description": "Custom pragma to use with JSX (same functionality as @jsx comments)", + "default": "React.createElement", + "shorthand": "P" + }, + "ignore": { "type": "list" }, diff --git a/src/babel/transformation/transformers/other/react.js b/src/babel/transformation/transformers/other/react.js index 2b098e5461..a729671dd3 100644 --- a/src/babel/transformation/transformers/other/react.js +++ b/src/babel/transformation/transformers/other/react.js @@ -4,7 +4,7 @@ import * as t from "../../../types"; var JSX_ANNOTATION_REGEX = /^\*\s*@jsx\s+([^\s]+)/; export function Program(node, parent, scope, file) { - var id = "React.createElement"; + var id = file.opts.jsxPragma; for (var i = 0; i < file.ast.comments.length; i++) { var comment = file.ast.comments[i];