getJSXPragmaInfo.js 589 B

12345678910111213141516171819202122
  1. "use strict";Object.defineProperty(exports, "__esModule", {value: true});
  2. function getJSXPragmaInfo(options) {
  3. const [base, suffix] = splitPragma(options.jsxPragma || "React.createElement");
  4. const [fragmentBase, fragmentSuffix] = splitPragma(options.jsxFragmentPragma || "React.Fragment");
  5. return {base, suffix, fragmentBase, fragmentSuffix};
  6. } exports.default = getJSXPragmaInfo;
  7. function splitPragma(pragma) {
  8. let dotIndex = pragma.indexOf(".");
  9. if (dotIndex === -1) {
  10. dotIndex = pragma.length;
  11. }
  12. return [pragma.slice(0, dotIndex), pragma.slice(dotIndex)];
  13. }