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 FLOW_DIRECTIVE = "@flow";
  13.  
  14.   return {
  15.     inherits: require("babel-plugin-syntax-flow"),
  16.  
  17.     visitor: {
  18.       Program: function Program(path, _ref2) {
  19.         var comments = _ref2.file.ast.comments;
  20.  
  21.         for (var _iterator = comments, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  22.           var _ref3;
  23.  
  24.           if (_isArray) {
  25.             if (_i >= _iterator.length) break;
  26.             _ref3 = _iterator[_i++];
  27.           } else {
  28.             _i = _iterator.next();
  29.             if (_i.done) break;
  30.             _ref3 = _i.value;
  31.           }
  32.  
  33.           var comment = _ref3;
  34.  
  35.           if (comment.value.indexOf(FLOW_DIRECTIVE) >= 0) {
  36.             comment.value = comment.value.replace(FLOW_DIRECTIVE, "");
  37.  
  38.             if (!comment.value.replace(/\*/g, "").trim()) comment.ignore = true;
  39.           }
  40.         }
  41.       },
  42.       Flow: function Flow(path) {
  43.         path.remove();
  44.       },
  45.       ClassProperty: function ClassProperty(path) {
  46.         path.node.variance = null;
  47.         path.node.typeAnnotation = null;
  48.         if (!path.node.value) path.remove();
  49.       },
  50.       Class: function Class(path) {
  51.         path.node.implements = null;
  52.  
  53.         path.get("body.body").forEach(function (child) {
  54.           if (child.isClassProperty()) {
  55.             child.node.typeAnnotation = null;
  56.             if (!child.node.value) child.remove();
  57.           }
  58.         });
  59.       },
  60.       AssignmentPattern: function AssignmentPattern(_ref4) {
  61.         var node = _ref4.node;
  62.  
  63.         node.left.optional = false;
  64.       },
  65.       Function: function Function(_ref5) {
  66.         var node = _ref5.node;
  67.  
  68.         for (var i = 0; i < node.params.length; i++) {
  69.           var param = node.params[i];
  70.           param.optional = false;
  71.         }
  72.       },
  73.       TypeCastExpression: function TypeCastExpression(path) {
  74.         var node = path.node;
  75.  
  76.         do {
  77.           node = node.expression;
  78.         } while (t.isTypeCastExpression(node));
  79.         path.replaceWith(node);
  80.       }
  81.     }
  82.   };
  83. };
  84.  
  85. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  86.  
  87. 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