BVB Source Codes

reactide Show index.js Source code

Return Download reactide: download index.js Source code - Download reactide Source code - Type:.js
  1. "use strict";
  2.  
  3. exports.__esModule = true;
  4.  
  5. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  6.  
  7. var _getIterator3 = _interopRequireDefault(_getIterator2);
  8.  
  9. exports.default = function (_ref) {
  10.   var t = _ref.types;
  11.  
  12.   var JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/;
  13.  
  14.   var visitor = (0, _babelHelperBuilderReactJsx2.default)({
  15.     pre: function pre(state) {
  16.       var tagName = state.tagName;
  17.       var args = state.args;
  18.       if (t.react.isCompatTag(tagName)) {
  19.         args.push(t.stringLiteral(tagName));
  20.       } else {
  21.         args.push(state.tagExpr);
  22.       }
  23.     },
  24.     post: function post(state, pass) {
  25.       state.callee = pass.get("jsxIdentifier")();
  26.     }
  27.   });
  28.  
  29.   visitor.Program = function (path, state) {
  30.     var file = state.file;
  31.  
  32.     var id = state.opts.pragma || "React.createElement";
  33.  
  34.     for (var _iterator = file.ast.comments, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  35.       var _ref2;
  36.  
  37.       if (_isArray) {
  38.         if (_i >= _iterator.length) break;
  39.         _ref2 = _iterator[_i++];
  40.       } else {
  41.         _i = _iterator.next();
  42.         if (_i.done) break;
  43.         _ref2 = _i.value;
  44.       }
  45.  
  46.       var comment = _ref2;
  47.  
  48.       var matches = JSX_ANNOTATION_REGEX.exec(comment.value);
  49.       if (matches) {
  50.         id = matches[1];
  51.         if (id === "React.DOM") {
  52.           throw file.buildCodeFrameError(comment, "The @jsx React.DOM pragma has been deprecated as of React 0.12");
  53.         } else {
  54.           break;
  55.         }
  56.       }
  57.     }
  58.  
  59.     state.set("jsxIdentifier", function () {
  60.       return id.split(".").map(function (name) {
  61.         return t.identifier(name);
  62.       }).reduce(function (object, property) {
  63.         return t.memberExpression(object, property);
  64.       });
  65.     });
  66.   };
  67.  
  68.   return {
  69.     inherits: _babelPluginSyntaxJsx2.default,
  70.     visitor: visitor
  71.   };
  72. };
  73.  
  74. var _babelPluginSyntaxJsx = require("babel-plugin-syntax-jsx");
  75.  
  76. var _babelPluginSyntaxJsx2 = _interopRequireDefault(_babelPluginSyntaxJsx);
  77.  
  78. var _babelHelperBuilderReactJsx = require("babel-helper-builder-react-jsx");
  79.  
  80. var _babelHelperBuilderReactJsx2 = _interopRequireDefault(_babelHelperBuilderReactJsx);
  81.  
  82. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  83.  
  84. module.exports = exports["default"];
downloadindex.js Source code - Download reactide Source code
Related Source Codes/Software:
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
postal - 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top