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. var _symbol = require("babel-runtime/core-js/symbol");
  10.  
  11. var _symbol2 = _interopRequireDefault(_symbol);
  12.  
  13. exports.default = function (_ref) {
  14.   var t = _ref.types;
  15.  
  16.   function Property(path, node, scope, getObjectRef, file) {
  17.     var replaceSupers = new _babelHelperReplaceSupers2.default({
  18.       getObjectRef: getObjectRef,
  19.       methodNode: node,
  20.       methodPath: path,
  21.       isStatic: true,
  22.       scope: scope,
  23.       file: file
  24.     });
  25.  
  26.     replaceSupers.replace();
  27.   }
  28.  
  29.   var CONTAINS_SUPER = (0, _symbol2.default)();
  30.  
  31.   return {
  32.     visitor: {
  33.       Super: function Super(path) {
  34.         var parentObj = path.findParent(function (path) {
  35.           return path.isObjectExpression();
  36.         });
  37.         if (parentObj) parentObj.node[CONTAINS_SUPER] = true;
  38.       },
  39.  
  40.  
  41.       ObjectExpression: {
  42.         exit: function exit(path, file) {
  43.           if (!path.node[CONTAINS_SUPER]) return;
  44.  
  45.           var objectRef = void 0;
  46.           var getObjectRef = function getObjectRef() {
  47.             return objectRef = objectRef || path.scope.generateUidIdentifier("obj");
  48.           };
  49.  
  50.           var propPaths = path.get("properties");
  51.           for (var _iterator = propPaths, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  52.             var _ref2;
  53.  
  54.             if (_isArray) {
  55.               if (_i >= _iterator.length) break;
  56.               _ref2 = _iterator[_i++];
  57.             } else {
  58.               _i = _iterator.next();
  59.               if (_i.done) break;
  60.               _ref2 = _i.value;
  61.             }
  62.  
  63.             var propPath = _ref2;
  64.  
  65.             if (propPath.isObjectProperty()) propPath = propPath.get("value");
  66.             Property(propPath, propPath.node, path.scope, getObjectRef, file);
  67.           }
  68.  
  69.           if (objectRef) {
  70.             path.scope.push({ id: objectRef });
  71.             path.replaceWith(t.assignmentExpression("=", objectRef, path.node));
  72.           }
  73.         }
  74.       }
  75.     }
  76.   };
  77. };
  78.  
  79. var _babelHelperReplaceSupers = require("babel-helper-replace-supers");
  80.  
  81. var _babelHelperReplaceSupers2 = _interopRequireDefault(_babelHelperReplaceSupers);
  82.  
  83. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  84.  
  85. 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