BVB Source Codes

reactide Show flow.js Source code

Return Download reactide: download flow.js Source code - Download reactide Source code - Type:.js
  1. "use strict";
  2.  
  3. exports.__esModule = true;
  4. exports.AnyTypeAnnotation = AnyTypeAnnotation;
  5. exports.ArrayTypeAnnotation = ArrayTypeAnnotation;
  6. exports.BooleanTypeAnnotation = BooleanTypeAnnotation;
  7. exports.BooleanLiteralTypeAnnotation = BooleanLiteralTypeAnnotation;
  8. exports.NullLiteralTypeAnnotation = NullLiteralTypeAnnotation;
  9. exports.DeclareClass = DeclareClass;
  10. exports.DeclareFunction = DeclareFunction;
  11. exports.DeclareInterface = DeclareInterface;
  12. exports.DeclareModule = DeclareModule;
  13. exports.DeclareModuleExports = DeclareModuleExports;
  14. exports.DeclareTypeAlias = DeclareTypeAlias;
  15. exports.DeclareVariable = DeclareVariable;
  16. exports.ExistentialTypeParam = ExistentialTypeParam;
  17. exports.FunctionTypeAnnotation = FunctionTypeAnnotation;
  18. exports.FunctionTypeParam = FunctionTypeParam;
  19. exports.InterfaceExtends = InterfaceExtends;
  20. exports._interfaceish = _interfaceish;
  21. exports._variance = _variance;
  22. exports.InterfaceDeclaration = InterfaceDeclaration;
  23. exports.IntersectionTypeAnnotation = IntersectionTypeAnnotation;
  24. exports.MixedTypeAnnotation = MixedTypeAnnotation;
  25. exports.EmptyTypeAnnotation = EmptyTypeAnnotation;
  26. exports.NullableTypeAnnotation = NullableTypeAnnotation;
  27.  
  28. var _types = require("./types");
  29.  
  30. Object.defineProperty(exports, "NumericLiteralTypeAnnotation", {
  31.   enumerable: true,
  32.   get: function get() {
  33.     return _types.NumericLiteral;
  34.   }
  35. });
  36. Object.defineProperty(exports, "StringLiteralTypeAnnotation", {
  37.   enumerable: true,
  38.   get: function get() {
  39.     return _types.StringLiteral;
  40.   }
  41. });
  42. exports.NumberTypeAnnotation = NumberTypeAnnotation;
  43. exports.StringTypeAnnotation = StringTypeAnnotation;
  44. exports.ThisTypeAnnotation = ThisTypeAnnotation;
  45. exports.TupleTypeAnnotation = TupleTypeAnnotation;
  46. exports.TypeofTypeAnnotation = TypeofTypeAnnotation;
  47. exports.TypeAlias = TypeAlias;
  48. exports.TypeAnnotation = TypeAnnotation;
  49. exports.TypeParameter = TypeParameter;
  50. exports.TypeParameterInstantiation = TypeParameterInstantiation;
  51. exports.ObjectTypeAnnotation = ObjectTypeAnnotation;
  52. exports.ObjectTypeCallProperty = ObjectTypeCallProperty;
  53. exports.ObjectTypeIndexer = ObjectTypeIndexer;
  54. exports.ObjectTypeProperty = ObjectTypeProperty;
  55. exports.QualifiedTypeIdentifier = QualifiedTypeIdentifier;
  56. exports.UnionTypeAnnotation = UnionTypeAnnotation;
  57. exports.TypeCastExpression = TypeCastExpression;
  58. exports.VoidTypeAnnotation = VoidTypeAnnotation;
  59. function AnyTypeAnnotation() {
  60.   this.word("any");
  61. }
  62.  
  63. function ArrayTypeAnnotation(node) {
  64.   this.print(node.elementType, node);
  65.   this.token("[");
  66.   this.token("]");
  67. }
  68.  
  69. function BooleanTypeAnnotation() {
  70.   this.word("boolean");
  71. }
  72.  
  73. function BooleanLiteralTypeAnnotation(node) {
  74.   this.word(node.value ? "true" : "false");
  75. }
  76.  
  77. function NullLiteralTypeAnnotation() {
  78.   this.word("null");
  79. }
  80.  
  81. function DeclareClass(node) {
  82.   this.word("declare");
  83.   this.space();
  84.   this.word("class");
  85.   this.space();
  86.   this._interfaceish(node);
  87. }
  88.  
  89. function DeclareFunction(node) {
  90.   this.word("declare");
  91.   this.space();
  92.   this.word("function");
  93.   this.space();
  94.   this.print(node.id, node);
  95.   this.print(node.id.typeAnnotation.typeAnnotation, node);
  96.   this.semicolon();
  97. }
  98.  
  99. function DeclareInterface(node) {
  100.   this.word("declare");
  101.   this.space();
  102.   this.InterfaceDeclaration(node);
  103. }
  104.  
  105. function DeclareModule(node) {
  106.   this.word("declare");
  107.   this.space();
  108.   this.word("module");
  109.   this.space();
  110.   this.print(node.id, node);
  111.   this.space();
  112.   this.print(node.body, node);
  113. }
  114.  
  115. function DeclareModuleExports(node) {
  116.   this.word("declare");
  117.   this.space();
  118.   this.word("module");
  119.   this.token(".");
  120.   this.word("exports");
  121.   this.print(node.typeAnnotation, node);
  122. }
  123.  
  124. function DeclareTypeAlias(node) {
  125.   this.word("declare");
  126.   this.space();
  127.   this.TypeAlias(node);
  128. }
  129.  
  130. function DeclareVariable(node) {
  131.   this.word("declare");
  132.   this.space();
  133.   this.word("var");
  134.   this.space();
  135.   this.print(node.id, node);
  136.   this.print(node.id.typeAnnotation, node);
  137.   this.semicolon();
  138. }
  139.  
  140. function ExistentialTypeParam() {
  141.   this.token("*");
  142. }
  143.  
  144. function FunctionTypeAnnotation(node, parent) {
  145.   this.print(node.typeParameters, node);
  146.   this.token("(");
  147.   this.printList(node.params, node);
  148.  
  149.   if (node.rest) {
  150.     if (node.params.length) {
  151.       this.token(",");
  152.       this.space();
  153.     }
  154.     this.token("...");
  155.     this.print(node.rest, node);
  156.   }
  157.  
  158.   this.token(")");
  159.  
  160.   if (parent.type === "ObjectTypeCallProperty" || parent.type === "DeclareFunction") {
  161.     this.token(":");
  162.   } else {
  163.     this.space();
  164.     this.token("=>");
  165.   }
  166.  
  167.   this.space();
  168.   this.print(node.returnType, node);
  169. }
  170.  
  171. function FunctionTypeParam(node) {
  172.   this.print(node.name, node);
  173.   if (node.optional) this.token("?");
  174.   this.token(":");
  175.   this.space();
  176.   this.print(node.typeAnnotation, node);
  177. }
  178.  
  179. function InterfaceExtends(node) {
  180.   this.print(node.id, node);
  181.   this.print(node.typeParameters, node);
  182. }
  183.  
  184. exports.ClassImplements = InterfaceExtends;
  185. exports.GenericTypeAnnotation = InterfaceExtends;
  186. function _interfaceish(node) {
  187.   this.print(node.id, node);
  188.   this.print(node.typeParameters, node);
  189.   if (node.extends.length) {
  190.     this.space();
  191.     this.word("extends");
  192.     this.space();
  193.     this.printList(node.extends, node);
  194.   }
  195.   if (node.mixins && node.mixins.length) {
  196.     this.space();
  197.     this.word("mixins");
  198.     this.space();
  199.     this.printList(node.mixins, node);
  200.   }
  201.   this.space();
  202.   this.print(node.body, node);
  203. }
  204.  
  205. function _variance(node) {
  206.   if (node.variance === "plus") {
  207.     this.token("+");
  208.   } else if (node.variance === "minus") {
  209.     this.token("-");
  210.   }
  211. }
  212.  
  213. function InterfaceDeclaration(node) {
  214.   this.word("interface");
  215.   this.space();
  216.   this._interfaceish(node);
  217. }
  218.  
  219. function andSeparator() {
  220.   this.space();
  221.   this.token("&");
  222.   this.space();
  223. }
  224.  
  225. function IntersectionTypeAnnotation(node) {
  226.   this.printJoin(node.types, node, { separator: andSeparator });
  227. }
  228.  
  229. function MixedTypeAnnotation() {
  230.   this.word("mixed");
  231. }
  232.  
  233. function EmptyTypeAnnotation() {
  234.   this.word("empty");
  235. }
  236.  
  237. function NullableTypeAnnotation(node) {
  238.   this.token("?");
  239.   this.print(node.typeAnnotation, node);
  240. }
  241.  
  242. function NumberTypeAnnotation() {
  243.   this.word("number");
  244. }
  245.  
  246. function StringTypeAnnotation() {
  247.   this.word("string");
  248. }
  249.  
  250. function ThisTypeAnnotation() {
  251.   this.word("this");
  252. }
  253.  
  254. function TupleTypeAnnotation(node) {
  255.   this.token("[");
  256.   this.printList(node.types, node);
  257.   this.token("]");
  258. }
  259.  
  260. function TypeofTypeAnnotation(node) {
  261.   this.word("typeof");
  262.   this.space();
  263.   this.print(node.argument, node);
  264. }
  265.  
  266. function TypeAlias(node) {
  267.   this.word("type");
  268.   this.space();
  269.   this.print(node.id, node);
  270.   this.print(node.typeParameters, node);
  271.   this.space();
  272.   this.token("=");
  273.   this.space();
  274.   this.print(node.right, node);
  275.   this.semicolon();
  276. }
  277.  
  278. function TypeAnnotation(node) {
  279.   this.token(":");
  280.   this.space();
  281.   if (node.optional) this.token("?");
  282.   this.print(node.typeAnnotation, node);
  283. }
  284.  
  285. function TypeParameter(node) {
  286.   this._variance(node);
  287.  
  288.   this.word(node.name);
  289.  
  290.   if (node.bound) {
  291.     this.print(node.bound, node);
  292.   }
  293.  
  294.   if (node.default) {
  295.     this.space();
  296.     this.token("=");
  297.     this.space();
  298.     this.print(node.default, node);
  299.   }
  300. }
  301.  
  302. function TypeParameterInstantiation(node) {
  303.   this.token("<");
  304.   this.printList(node.params, node, {});
  305.   this.token(">");
  306. }
  307.  
  308. exports.TypeParameterDeclaration = TypeParameterInstantiation;
  309. function ObjectTypeAnnotation(node) {
  310.   var _this = this;
  311.  
  312.   if (node.exact) {
  313.     this.token("{|");
  314.   } else {
  315.     this.token("{");
  316.   }
  317.  
  318.   var props = node.properties.concat(node.callProperties, node.indexers);
  319.  
  320.   if (props.length) {
  321.     this.space();
  322.  
  323.     this.printJoin(props, node, {
  324.       addNewlines: function addNewlines(leading) {
  325.         if (leading && !props[0]) return 1;
  326.       },
  327.  
  328.       indent: true,
  329.       statement: true,
  330.       iterator: function iterator() {
  331.         if (props.length !== 1) {
  332.           if (_this.format.flowCommaSeparator) {
  333.             _this.token(",");
  334.           } else {
  335.             _this.semicolon();
  336.           }
  337.           _this.space();
  338.         }
  339.       }
  340.     });
  341.  
  342.     this.space();
  343.   }
  344.  
  345.   if (node.exact) {
  346.     this.token("|}");
  347.   } else {
  348.     this.token("}");
  349.   }
  350. }
  351.  
  352. function ObjectTypeCallProperty(node) {
  353.   if (node.static) {
  354.     this.word("static");
  355.     this.space();
  356.   }
  357.   this.print(node.value, node);
  358. }
  359.  
  360. function ObjectTypeIndexer(node) {
  361.   if (node.static) {
  362.     this.word("static");
  363.     this.space();
  364.   }
  365.   this._variance(node);
  366.   this.token("[");
  367.   this.print(node.id, node);
  368.   this.token(":");
  369.   this.space();
  370.   this.print(node.key, node);
  371.   this.token("]");
  372.   this.token(":");
  373.   this.space();
  374.   this.print(node.value, node);
  375. }
  376.  
  377. function ObjectTypeProperty(node) {
  378.   if (node.static) {
  379.     this.word("static");
  380.     this.space();
  381.   }
  382.   this._variance(node);
  383.   this.print(node.key, node);
  384.   if (node.optional) this.token("?");
  385.   this.token(":");
  386.   this.space();
  387.   this.print(node.value, node);
  388. }
  389.  
  390. function QualifiedTypeIdentifier(node) {
  391.   this.print(node.qualification, node);
  392.   this.token(".");
  393.   this.print(node.id, node);
  394. }
  395.  
  396. function orSeparator() {
  397.   this.space();
  398.   this.token("|");
  399.   this.space();
  400. }
  401.  
  402. function UnionTypeAnnotation(node) {
  403.   this.printJoin(node.types, node, { separator: orSeparator });
  404. }
  405.  
  406. function TypeCastExpression(node) {
  407.   this.token("(");
  408.   this.print(node.expression, node);
  409.   this.print(node.typeAnnotation, node);
  410.   this.token(")");
  411. }
  412.  
  413. function VoidTypeAnnotation() {
  414.   this.word("void");
  415. }
downloadflow.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