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 _symbol = require("babel-runtime/core-js/symbol");
  6.  
  7. var _symbol2 = _interopRequireDefault(_symbol);
  8.  
  9. exports.default = function (_ref) {
  10.   var t = _ref.types;
  11.  
  12.   var VISITED = (0, _symbol2.default)();
  13.  
  14.   return {
  15.     visitor: {
  16.       ExportDefaultDeclaration: function ExportDefaultDeclaration(path) {
  17.         if (!path.get("declaration").isClassDeclaration()) return;
  18.  
  19.         var node = path.node;
  20.  
  21.         var ref = node.declaration.id || path.scope.generateUidIdentifier("class");
  22.         node.declaration.id = ref;
  23.  
  24.         path.replaceWith(node.declaration);
  25.         path.insertAfter(t.exportDefaultDeclaration(ref));
  26.       },
  27.       ClassDeclaration: function ClassDeclaration(path) {
  28.         var node = path.node;
  29.  
  30.  
  31.         var ref = node.id || path.scope.generateUidIdentifier("class");
  32.  
  33.         path.replaceWith(t.variableDeclaration("let", [t.variableDeclarator(ref, t.toExpression(node))]));
  34.       },
  35.       ClassExpression: function ClassExpression(path, state) {
  36.         var node = path.node;
  37.  
  38.         if (node[VISITED]) return;
  39.  
  40.         var inferred = (0, _babelHelperFunctionName2.default)(path);
  41.         if (inferred && inferred !== node) return path.replaceWith(inferred);
  42.  
  43.         node[VISITED] = true;
  44.  
  45.         var Constructor = _vanilla2.default;
  46.         if (state.opts.loose) Constructor = _loose2.default;
  47.  
  48.         path.replaceWith(new Constructor(path, state.file).run());
  49.       }
  50.     }
  51.   };
  52. };
  53.  
  54. var _loose = require("./loose");
  55.  
  56. var _loose2 = _interopRequireDefault(_loose);
  57.  
  58. var _vanilla = require("./vanilla");
  59.  
  60. var _vanilla2 = _interopRequireDefault(_vanilla);
  61.  
  62. var _babelHelperFunctionName = require("babel-helper-function-name");
  63.  
  64. var _babelHelperFunctionName2 = _interopRequireDefault(_babelHelperFunctionName);
  65.  
  66. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  67.  
  68. 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