react 0.3.5 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/.npmignore +2 -1
  2. package/.travis.yml +4 -0
  3. package/Jakefile.js +34 -3
  4. package/README.md +34 -174
  5. package/browser-test/dist.html +90 -0
  6. package/browser-test/index.html +86 -0
  7. package/browser-test/min.html +90 -0
  8. package/dist/react.js +3291 -0
  9. package/dist/react.min.js +1 -0
  10. package/doc/advanced.md +166 -0
  11. package/doc/color-def.graffle +938 -0
  12. package/doc/color-def.png +0 -0
  13. package/doc/simple.dot +25 -0
  14. package/doc/simple.png +0 -0
  15. package/examples/{default1.js → longer-example.js} +0 -0
  16. package/examples/{default-simple.js → simple.js} +0 -0
  17. package/examples/{ast1.js → using-ast-directly.js} +4 -0
  18. package/examples/{default-events1.js → using-events1.js} +1 -1
  19. package/examples/{default-log-events.js → using-log-events.js} +1 -1
  20. package/lib/base-task.js +116 -110
  21. package/lib/cb-task.js +71 -67
  22. package/lib/core.js +120 -109
  23. package/lib/dsl.js +120 -115
  24. package/lib/error.js +44 -36
  25. package/lib/event-collector.js +81 -0
  26. package/lib/event-manager.js +66 -55
  27. package/lib/eventemitter.js +20 -0
  28. package/lib/finalcb-first-task.js +56 -53
  29. package/lib/finalcb-task.js +55 -51
  30. package/lib/id.js +18 -6
  31. package/lib/input-parser.js +49 -41
  32. package/lib/log-events.js +81 -60
  33. package/lib/parse.js +34 -25
  34. package/lib/promise-resolve.js +50 -0
  35. package/lib/promise-task.js +78 -74
  36. package/lib/react.js +59 -0
  37. package/lib/ret-task.js +59 -55
  38. package/lib/sprintf.js +18 -0
  39. package/lib/status.js +11 -2
  40. package/lib/task.js +219 -213
  41. package/lib/track-tasks.js +67 -110
  42. package/lib/validate.js +136 -136
  43. package/lib/vcon.js +78 -69
  44. package/lib/when-task.js +69 -65
  45. package/package.json +11 -9
  46. package/src/dist.build.requirejs +20 -0
  47. package/test/ast.mocha.js +136 -0
  48. package/test/cb-task.mocha.js +220 -0
  49. package/test/core-deferred.mocha.js +143 -0
  50. package/test/core-when.mocha.js +96 -0
  51. package/test/core.mocha.js +589 -0
  52. package/test/dsl.mocha.js +350 -0
  53. package/test/event-manager.mocha.js +119 -0
  54. package/test/exec-options.mocha.js +48 -0
  55. package/test/finalcb-task.mocha.js +58 -0
  56. package/test/input-parser.mocha.js +86 -0
  57. package/test/mocha.opts +2 -0
  58. package/test/module-use.mocha.js +147 -0
  59. package/test/promise-auto-resolve.mocha.js +68 -0
  60. package/test/ret-task.mocha.js +220 -0
  61. package/test/task.mocha.js +42 -0
  62. package/test/validate-cb-task.mocha.js +100 -0
  63. package/test/validate-ret-task.mocha.js +110 -0
  64. package/test/validate.mocha.js +324 -0
  65. package/test/vcon.mocha.js +193 -0
  66. package/vendor/chai/chai.js +2038 -0
  67. package/vendor/jquery/jquery-1.7.1.js +9266 -0
  68. package/vendor/jquery/jquery-1.7.1.min.js +4 -0
  69. package/vendor/mocha/mocha.css +135 -0
  70. package/vendor/mocha/mocha.js +3589 -0
  71. package/vendor/node/util.js +531 -0
  72. package/vendor/requirejs/require.js +2053 -0
  73. package/vendor/requirejs/require.min.js +33 -0
  74. package/doc/alternate-dsls.md +0 -103
  75. package/doc/default-simple.dot +0 -19
  76. package/doc/default-simple.dot.png +0 -0
  77. package/dsl/chain.js +0 -150
  78. package/dsl/fstr.js +0 -121
  79. package/dsl/pcode.js +0 -175
  80. package/examples/chain-events1.js +0 -55
  81. package/examples/chain1.js +0 -19
  82. package/examples/fstr-events1.js +0 -38
  83. package/examples/fstr1.js +0 -37
  84. package/examples/pcode1.js +0 -22
  85. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia.html +0 -675
  86. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/37px-Wiktionary-logo-en.svg.png +0 -0
  87. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/closewindow.png +0 -0
  88. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/index(1).php +0 -407
  89. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/index.php +0 -130
  90. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(1).php +0 -3
  91. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(10).php +0 -89
  92. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(2).php +0 -23
  93. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(3).php +0 -153
  94. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(4).php +0 -6
  95. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(5).php +0 -3
  96. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(6).php +0 -96
  97. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(7).php +0 -16
  98. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(8).php +0 -14
  99. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(9).php +0 -123
  100. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load.php +0 -3
  101. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/poweredby_mediawiki_88x31.png +0 -0
  102. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/saved_resource +0 -1
  103. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/search-ltr.png +0 -0
  104. package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/wikimedia-button.png +0 -0
  105. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's.html +0 -1369
  106. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/121911_DobbsDigest_Cover.jpg +0 -0
  107. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/160-x-600-IMU Impact 2012.jpg +0 -0
  108. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp= +0 -68
  109. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=(1) +0 -67
  110. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=(2) +0 -2
  111. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=(3) +0 -2
  112. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=(4) +0 -8
  113. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=(5) +0 -2
  114. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461 +0 -2
  115. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(1) +0 -2
  116. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(2) +0 -2
  117. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(3) +0 -2
  118. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(4) +0 -2
  119. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(5) +0 -431
  120. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(6) +0 -2
  121. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(7) +0 -431
  122. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(8) +0 -2
  123. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(9) +0 -2
  124. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/Ad0St1Sz6Sq0V0Id20628317.gif +0 -0
  125. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/Ad2331174St1Sz225Sq20825250V0Id4.gif +0 -0
  126. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/AdTracImage.gif +0 -0
  127. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/Default_Size_16_1x1.gif +0 -0
  128. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/FB.Share +0 -9
  129. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/addthis_widget.js +0 -2
  130. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/adlink_5242_1183459_0_154_AdId=2355270;BnId=1;itime=820768810;key=231400148+_database_231400148;link= +0 -11
  131. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/beacon.js +0 -7
  132. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/checkauth.js +0 -18
  133. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/colorbox.css +0 -49
  134. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/convert_data.js +0 -1
  135. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/count(1).js +0 -5
  136. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/count.js +0 -5
  137. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/count.json +0 -1
  138. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/dataflow1.gif +0 -0
  139. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/def.html +0 -126
  140. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/defaults.css +0 -1
  141. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/detect.js +0 -91
  142. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/devtest_left-col-slim.css +0 -30
  143. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/disqus.js +0 -327
  144. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/disqusHints.css +0 -34
  145. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/disqusHints.js +0 -8
  146. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/disqusLoggedOff(1).css +0 -24
  147. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/disqusLoggedOff.css +0 -24
  148. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/dobbs_disqus_logo.gif +0 -0
  149. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/dsqcd10c7f376188a4a2ca3e8fea2c03aeb.css +0 -1
  150. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/dsqcd10c7f376188a4a2ca3e8fea2c03aeb.js +0 -1
  151. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/elqCfg.js +0 -55
  152. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/elqImg.js +0 -12
  153. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/embed.js +0 -76
  154. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/experience_util.js +0 -636
  155. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/fastbutton.html +0 -11
  156. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/ga.js +0 -51
  157. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/h-facebook_sm.png +0 -0
  158. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/h-nav.css +0 -798
  159. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/h-twitter_sm.png +0 -0
  160. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/h_s_code_remote.js +0 -377
  161. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/hintbox_info.jpg +0 -0
  162. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/hub.1326407570.html +0 -3
  163. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/in.js +0 -76
  164. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/insight.min.js +0 -55
  165. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/jquery-1.2.6.min.js +0 -32
  166. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/jquery-1.4.2.min.js +0 -154
  167. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/jquery-ui-1.8rc3.custom.min.js +0 -374
  168. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/jquery.colorbox-min.js +0 -4
  169. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/jquery.min.js +0 -154
  170. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/lib.js +0 -212
  171. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/like.html +0 -214
  172. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/noavatar32.png +0 -0
  173. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/nodetag.js +0 -18
  174. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/nonSecureAnonymousFramework +0 -2913
  175. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/p.json +0 -1
  176. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/plusone.js +0 -32
  177. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/popwindow.js +0 -24
  178. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/q4OyybLB0-A.js +0 -91
  179. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/quant.js +0 -28
  180. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/qxvZoiHdpAF.css +0 -192
  181. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/reply.html +0 -160
  182. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/rss.gif +0 -0
  183. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/s.js +0 -1
  184. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/saved_resource +0 -421
  185. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/saved_resource(1) +0 -1
  186. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/saved_resource(2) +0 -341
  187. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/saved_resource(3) +0 -127
  188. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/script84.js +0 -113
  189. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/scripts.js +0 -30
  190. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/sh72.html +0 -5
  191. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shAutoloader.js +0 -17
  192. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushAS3.js +0 -59
  193. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushAppleScript.js +0 -75
  194. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushBash.js +0 -59
  195. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushCSharp.js +0 -65
  196. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushColdFusion.js +0 -100
  197. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushCpp.js +0 -97
  198. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushCss.js +0 -91
  199. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushDelphi.js +0 -55
  200. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushDiff.js +0 -41
  201. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushErlang.js +0 -52
  202. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushGroovy.js +0 -67
  203. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushJScript.js +0 -52
  204. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushJava.js +0 -57
  205. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushJavaFX.js +0 -58
  206. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushPerl.js +0 -72
  207. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushPhp.js +0 -88
  208. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushPlain.js +0 -33
  209. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushPowerShell.js +0 -74
  210. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushPython.js +0 -64
  211. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushRuby.js +0 -55
  212. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushSass.js +0 -94
  213. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushScala.js +0 -51
  214. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushSql.js +0 -66
  215. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushVb.js +0 -56
  216. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushXml.js +0 -69
  217. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shCore.css +0 -226
  218. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shCoreDefault.css +0 -333
  219. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shCore_new.js +0 -17
  220. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shLegacy.js +0 -17
  221. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shThemeDefault.css +0 -117
  222. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/share-button-css +0 -67
  223. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/share_email_icon.gif +0 -0
  224. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/share_print_icon.gif +0 -0
  225. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/sidebar.js +0 -88
  226. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/superfooter_936.css +0 -186
  227. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/svrGP.aspx +0 -0
  228. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/t.gif +0 -0
  229. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/thickbox.js +0 -343
  230. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/thread.js +0 -128
  231. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/togglediv.js +0 -15
  232. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/tweet_button.html +0 -3
  233. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/ubmtechweb_logo_sm.gif +0 -0
  234. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/upload.html +0 -91
  235. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/welcome.js +0 -7
  236. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/widget74.css +0 -1
  237. package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/widgets.js +0 -40
  238. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia.html +0 -904
  239. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/50px-Question_book-new.svg.png +0 -0
  240. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/closewindow.png +0 -0
  241. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/index(1).php +0 -407
  242. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/index.php +0 -130
  243. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(1).php +0 -3
  244. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(10).php +0 -89
  245. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(2).php +0 -23
  246. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(3).php +0 -153
  247. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(4).php +0 -6
  248. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(5).php +0 -3
  249. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(6).php +0 -96
  250. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(7).php +0 -16
  251. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(8).php +0 -14
  252. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(9).php +0 -123
  253. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load.php +0 -3
  254. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/poweredby_mediawiki_88x31.png +0 -0
  255. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/saved_resource +0 -1
  256. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/search-ltr.png +0 -0
  257. package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/wikimedia-button.png +0 -0
  258. package/externalDocs/The Step of the Conductor - How To Node - NodeJS.html +0 -113
  259. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/6654_111305815684_541245684_2583159_5383291_n_normal.jpg +0 -0
  260. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/MARC3_normal.jpg +0 -2
  261. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/beacon.js +0 -7
  262. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/c953ddd239707998340e1a6fbb3eeb46 +0 -0
  263. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/c953ddd239707998340e1a6fbb3eeb46_normal.jpeg +0 -0
  264. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/clouds2_normal.jpg +0 -0
  265. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/count.json +0 -1
  266. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/def.html +0 -126
  267. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/defaults.css +0 -1
  268. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/disqus.js +0 -327
  269. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/dsq7884a9652e94555c70f96b6be63be216.css +0 -1
  270. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/dsq7884a9652e94555c70f96b6be63be216.js +0 -66
  271. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/embed.js +0 -76
  272. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/example1.dot +0 -0
  273. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/ga.js +0 -51
  274. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/get_num_replies.js +0 -79
  275. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/hub.1326407570.html +0 -3
  276. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/lib.js +0 -212
  277. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/noavatar32.png +0 -0
  278. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/quant.js +0 -28
  279. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/reply.html +0 -160
  280. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/t.gif +0 -0
  281. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/thread.js +0 -128
  282. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/tweet_button.1326407570.html +0 -3
  283. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/twitter_normal.jpg +0 -2
  284. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/upload.html +0 -91
  285. package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/widgets.js +0 -40
  286. package/jake-tasks/jake-test.js +0 -64
  287. package/promise-resolve.js +0 -35
  288. package/react.js +0 -8
  289. package/test/ast.test.js +0 -69
  290. package/test/cb-task.test.js +0 -197
  291. package/test/core-deferred.test.js +0 -134
  292. package/test/core-promised.test.js +0 -132
  293. package/test/core-when.test.js +0 -84
  294. package/test/core.test.js +0 -568
  295. package/test/dsl.test.js +0 -330
  296. package/test/dsl/chain.test.js +0 -324
  297. package/test/dsl/fstr.test.js +0 -300
  298. package/test/dsl/pcode.test.js +0 -448
  299. package/test/event-manager.test.js +0 -102
  300. package/test/exec-options.test.js +0 -33
  301. package/test/finalcb-task.test.js +0 -38
  302. package/test/input-parser.test.js +0 -66
  303. package/test/module-use.test.js +0 -131
  304. package/test/promise-auto-resolve.test.js +0 -51
  305. package/test/ret-task.test.js +0 -199
  306. package/test/task.test.js +0 -21
  307. package/test/validate-cb-task.test.js +0 -74
  308. package/test/validate-ret-task.test.js +0 -83
  309. package/test/validate.test.js +0 -295
  310. package/test/vcon.test.js +0 -173
package/.npmignore CHANGED
@@ -3,4 +3,5 @@ npm-debug.log
3
3
  ./npmrc
4
4
  todo.md
5
5
  notes.md
6
- oldExamples
6
+ .DS_Store
7
+ externalDocs
package/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: node_js
2
+ node_js:
3
+ - 0.6
4
+ - 0.7
package/Jakefile.js CHANGED
@@ -1,8 +1,39 @@
1
+ 'use strict';
2
+ /*global fail:false, complete:false, desc:false, jake:false, namespace:false, task:false */
1
3
 
4
+ var path = require('path');
5
+ var child_process = require('child_process');
2
6
 
3
- require('./jake-tasks/jake-test.js');
7
+ var REQUIREJS = path.resolve(__dirname, 'node_modules/requirejs/bin/r.js');
8
+
9
+ desc('Default - build all dist versions');
10
+ task('default', ['dist-all'], function (params) { });
11
+
12
+
13
+ function runRequireJs(argStr) {
14
+ var proc = child_process.spawn(REQUIREJS, argStr.split(' '));
15
+ proc.stdout.pipe(process.stdout);
16
+ proc.stderr.pipe(process.stderr);
17
+ proc.on('exit', function (exitCode) {
18
+ if (exitCode !== 0) {
19
+ console.error('Child process exited with error code: %s, exiting', exitCode);
20
+ process.exit(exitCode);
21
+ }
22
+ });
23
+ }
24
+
25
+ desc('Create core single-file developer dist');
26
+ task('dist', function () {
27
+ runRequireJs('-o src/dist.build.requirejs out=dist/react.js');
28
+ });
29
+
30
+ desc('Create full single-file minified dist');
31
+ task('min', function () {
32
+ runRequireJs('-o src/dist.build.requirejs out=dist/react.min.js optimize=uglify');
33
+ });
34
+
35
+ desc('Create all dist versions');
36
+ task('dist-all', ['dist', 'min']);
4
37
 
5
- desc('Default - run watch');
6
- task('default', ['test:watch']);
7
38
 
8
39
 
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # React.js
2
2
 
3
+ [![Build Status](https://secure.travis-ci.org/jeffbski/react.png?branch=master)](http://travis-ci.org/jeffbski/react)
4
+
3
5
  React is a javascript module to make it easier to work with asynchronous code, by reducing boilerplate code and improving error and exception handling while allowing variable and task dependencies when defining flow. This project is applying the concepts of Reactive programming or Dataflow to controlling application flow.
4
6
 
5
7
  This async flow control module is initially designed to work with Node.js but is planned to be extended to browser and other environments.
@@ -35,8 +37,8 @@ It takes inspiration from several projects including:
35
37
  - object instance method calls
36
38
  - class method calls
37
39
  - selectFirst flow where the first task that returns defined, non-null value is used
38
- - promise style functions - also automatic resolution of promise inputs (optional require('react/promise-resolve');)
39
- - use of resulting flow function as callback style or promise style (if no callback provided) (provided via plugin corresponding to the promise library used)
40
+ - promise style functions - also automatic resolution of promise inputs (optionally loaded with `react.resolvePromises();`)
41
+ - use of resulting flow function as callback style or promise style (if no callback provided) (provided via plugin corresponding to the promise library used) See https://github.com/jeffbski/react-deferred
40
42
  - (planned) iteration on arrays, streams, sockets
41
43
  - (planned) event emitter integration
42
44
 
@@ -72,17 +74,8 @@ Pull from github - http://github.com/jeffbski/react
72
74
 
73
75
  ## Examples
74
76
 
75
- 1. [Direct AST](#directAST)
76
- 2. [Default DSL](#defaultDSL)
77
-
78
- ### Example using the default DSL
79
-
80
- These live in the examples folder so they are ready to run.
81
- Also see test/module-use.test.js for more examples as well
82
- as the specific tests for the DSL you want to use.
83
-
84
77
  <a name="defaultDSL"/>
85
- ### Example using default DSL
78
+ ### Example using default DSL interface
86
79
 
87
80
  - Simple example showing flow definition of two async functions feeding a
88
81
  synchronous function.
@@ -137,179 +130,66 @@ foobar.loadRender('foo.txt', 'bar.txt', 'BBB', function (err, renderedOut) {
137
130
  ```
138
131
 
139
132
  Below is a graph of how the dependencies are mapped by React which
140
- also indicates how the tasks will be executed
141
-
142
- ![default-simple.dot.png](https://github.com/jeffbski/react/raw/master/doc/default-simple.dot.png)
143
-
144
-
145
- <a name="directAST"/>
146
- ### Example directly using AST
147
-
148
- ```javascript
149
- var react = require('react');
150
-
151
- function load(res, cb) { setTimeout(cb, 100, null, res + '-loaded'); }
152
- function prefix(prefstr, str, cb) { setTimeout(cb, 100, null, prefstr + str); }
153
- function postfix(str, poststr, cb) { setTimeout(cb, 100, null, str + poststr); }
154
- function upper(str) { return str.toUpperCase(); }
155
-
156
- var fn = react();
157
- var errors = fn.setAndValidateAST({
158
- inParams: ['res', 'prefstr', 'poststr'],
159
- tasks: [
160
- { f: load, a: ['res'], out: ['lres'] },
161
- { f: upper, a: ['lres'], out: ['ulres'], type: 'ret' },
162
- { f: prefix, a: ['prefstr', 'ulres'], out: ['plres'] },
163
- { f: postfix, a: ['plres', 'poststr'], out: ['plresp'] }
164
- ],
165
- outTask: { a: ['plresp'] }
166
- });
167
- console.error('errors:', errors); // []
168
-
169
- fn('foo', 'pre-', '-post', function cb(err, lres) {
170
- console.error('err:', err); // null
171
- console.error('lres:', lres); // pre-FOO-LOADED-post
172
- });
173
- ```
133
+ also indicates how the tasks will be executed. This was generated by the
134
+ react plugin [react-graphviz](https://github.com/jeffbski/react-graphviz)
135
+ which you can use to also graph your flows.
174
136
 
175
- ### Alternate interfaces (DSL's)
137
+ ![simple.png](https://github.com/jeffbski/react/raw/master/doc/simple.png)
176
138
 
177
- 1. [Using pseudocode DSL](https://github.com/jeffbski/react/blob/master/doc/alternate-dsls.md#pcode)
178
- 2. [Using jquery-like chaining DSL](https://github.com/jeffbski/react/blob/master/doc/alternate-dsls.md#chain)
179
- 3. [Using function string DSL](https://github.com/jeffbski/react/blob/master/doc/alternate-dsls.md#fstr)
180
139
 
181
140
 
182
141
  ## User API
183
142
 
184
- ### Default DSL
185
-
186
143
  The main function returned from require('react') can be used to define the AST used for the processing of the rules or flow.
187
144
 
188
145
  It takes the following arguments to define a flow function:
189
146
 
190
147
  ```javascript
191
- var react = require('react');
192
- var fn = react('my-flow-name', 'paramName1, paramName2, cb -> err, outParamName1, outParamName2',
193
- functionRefOrMethodStr, 'paramName1, cb -> err, outParamName2', // async cb task
194
- functionRefOrMethodStr2, 'paramName2, paramName1 -> outParamName1' // sync task
148
+ var fn = react('loadRender', 'fooPath, barPath, barP2, cb -> err, renderedOut',
149
+ loadFoo, 'fooPath, cb -> err, foo',
150
+ loadBar, 'barPath, barP2, cb -> err, bar',
151
+ render, 'foo, bar -> renderedOut'
195
152
  );
196
153
  ```
197
154
 
155
+ ![color-def](https://github.com/jeffbski/react/raw/master/doc/color-def.png)
156
+
198
157
  1. **flow/function name** - string - represents the name of the flow or function that will be created. React will use the name when generating events so you can monitor progress and performance and also when errors occur.
199
158
  2. **in/out flow parameter definition** - string - the inputs and outputs for the flow function. The parameters are specified in one single string for easy typing, separated by commas. The output follows the input after being separated by a `->`. Use the parameter name `cb` or `callback` to specify the Node style callback and `err` to represent the error parameter as the first output parameter of the callback. Literal values can also be specified directly (true, false, numbers, this, null). Literal strings can simply be quoted using single or double quotes.
200
159
  3. **optional flow options** - object - If an object is provided immediately after the in/out flow def, then these options will be provided to react to customize the flow. This is reserved for future use.
201
- 3. **function reference or method string** - Specify the function to be called for this task, or if calling a method off of an object being passed in or returned by a task, use a string to specify like `'obj.method'`. These can be asynchronous Node-style callback `cb(err, ...)` functions or synchronous functions which simply return values directly.
202
- 4. **in/out task parameter definition** - string - similar to the in/out flow parameter definition above, these are the inputs and outputs that are passed to a task function and returned from a task function. The inputs will need to match either those from the flow inputs or outputs from other tasks that will run before this task. React will use the inputs as dependencies, so it will invoke and wait for response from the tasks that provide the dependent inputs. So simply by specifying inputs and outputs for the tasks, React will prioritize and parallelize tasks to run as fast as possible. Use `cb` or `callback` along with `err` to specify asynchronous Node style `cb(err, ...)` task, or omit both to specify a synchronous task.A synchronous task can only have a single return parameter.
203
- 5. **optional task options** - object - if an object is provided this can be used to specify additional options for this task. Currently the valid options for a task are:
160
+ 4. **function reference or method string** - Specify the function to be called for this task, or if calling a method off of an object being passed in or returned by a task, use a string to specify like `'obj.method'`. These can be asynchronous Node-style callback `cb(err, ...)` functions or synchronous functions which simply return values directly.
161
+ 5. **in/out task parameter definition** - string - similar to the in/out flow parameter definition above, these are the inputs and outputs that are passed to a task function and returned from a task function. The inputs will need to match either those from the flow inputs or outputs from other tasks that will run before this task. React will use the inputs as dependencies, so it will invoke and wait for response from the tasks that provide the dependent inputs. So simply by specifying inputs and outputs for the tasks, React will prioritize and parallelize tasks to run as fast as possible. Use `cb` or `callback` along with `err` to specify asynchronous Node style `cb(err, ...)` task, or omit both to specify a synchronous task.A synchronous task can only have a single return parameter.
162
+ 6. **optional task options** - object - if an object is provided this can be used to specify additional options for this task. Currently the valid options for a task are:
204
163
  - **name** - string - specifies a name for a task, otherwise React will try to use the function name or method string if it is unique in the flow. If a name is not unique subsequent tasks will have `_index` (zero based index of the task) added to create unique name. If you specify a name, you will also want to indicate a unique name for within the flow otherwise it will get a suffix as well. Example: `{ name: 'myTaskName' }`
205
164
  - **after** - string, function reference, or array of string or function refs - specify additional preconditions that need to be complete before this task can run. In addition to the input dependencies being met, wait for these named tasks to complete before running. The preconditions are specified using the name of the task or if the task function was only used once and is a named function (not anonymous), you can just provide the function reference and it will determine name from it. Example: `{ after: 'foo' }` or `{ after: ['foo', 'bar'] }`
206
- 6. **repeat 3-5** - repeat steps 3-5 to specify additional tasks in this flow. As dependencies are met for tasks, React will invoke additional tasks that are ready to run in the order they are defined in this flow definition. So while the order does have some influence on the execution, it is primarily defined by the input dependencies and any other additonal preconditions specified with the `after` option. If you want to guarantee that something only runs after something else completes, then it will need to use an output from that task or specify the dependency with an `after`.
165
+ 7. **repeat 4-6** - repeat steps 4-6 to specify additional tasks in this flow. As dependencies are met for tasks, React will invoke additional tasks that are ready to run in the order they are defined in this flow definition. So while the order does have some influence on the execution, it is primarily defined by the input dependencies and any other additonal preconditions specified with the `after` option. If you want to guarantee that something only runs after something else completes, then it will need to use an output from that task or specify the dependency with an `after`.
207
166
 
208
167
 
209
168
  The flow function created by react from the input definition is a normal Node-style function which can be used like any other. These flow functions can be defined in a module and exported, they can be passed into other functions, used as methods on objects (the `this` context is passed in and available).
210
169
 
170
+ ### Debugging React
211
171
 
212
- ### AST
213
-
214
- The abstract syntax tree or AST provided by React represents the data necessary to define the flow. By abstracting this from the DSL, it allows new skins or interfaces to be developed without need to change the core engine.
215
-
216
- The AST is normally created at parse time when the React main function is called (or one of the alternate DSL's is called). This can be done a module load time such that after loading the React defined flow function's AST is generated and ready to process eliminating parsing and validation overhead when it is invoked in the future. This has the added advantage that since validation has also been performed that additional syntax issues or incomplete flow defintion errors can be caught quickly.
217
-
218
- After the flow function has been created, you can review the generated AST for a function by accessing the ast.
172
+ React has a built-in plugin which can be loaded that will enable logging of tasks and flow as it executes very useful for debugging. For full details see [Advanced React - LogEvents](https://github.com/jeffbski/react/blob/master/doc/advanced.md#LogEvents) along with the other plugins and an explanation of the AST React uses.
219
173
 
220
174
  ```javascript
221
175
  var react = require('react');
222
- var fn = react('my-flow-name', 'paramName1, paramName2, cb -> err, outParamName1, outParamName2',
223
- functionRefOrMethodStr, 'paramName1, cb -> err, outParamName2', // async cb task
224
- functionRefOrMethodStr2, 'paramName2, paramName1 -> outParamName1' // sync task
225
- );
226
-
227
- console.error(fn.ast); // output the generated AST
228
- ```
229
-
230
- The AST contains the following pieces:
231
-
232
- ```javascript
233
- var ast = {
234
- name: flowName,
235
- inParams: [],
236
- tasks: [],
237
- outTask: {},
238
- locals: {}
239
- };
240
- ```
241
- - **name** - string - represents the name of the flow or function that will be created. React will use the name when generating events so you can monitor progress and performance and also when errors occur.
242
- - **inParams** - array of strings - the flow input parameter names (excluding the callback param)
243
- - **tasks** - array of task defintion objects - each containing:
244
- - **f** - function reference or method string - async or sync function to be used for this task
245
- - **a** - array of input parameter names (excluding the callback param)
246
- - **out** - array of output parameter names (excluding the err parame)
247
- - **type** - type of function determining how function is invoked and its output style - one of: ('cb', 'ret', 'promise', 'when')
248
- - **name** - string - unique name for each task provided or generated by React
249
- - **outTask** - task definition object specifying the flow's output style and parameters containing:
250
- - **f** - will contain reference to the callback function at runtime
251
- - **a** - parameters being passed as output from the flow
252
- - **locals** - object provided which contains additional values that will become part of the React variable space like input parameters but can be defined in advance at flow definition. This can be used to provide functions and objects to React enabling string based DSL's like the pcode DSL can be utilized.
253
-
254
-
255
- ### Plugins (optional requires which turn on additional functionality)
256
-
257
- Additional functionality which is not enabled by default but available by requiring additional modules.
258
-
259
-
260
- #### LogEvents - log react progress to stderr
261
-
262
- For convenience in debugging or in monitoring flow and performance, React has a built-in plugin for easily logging progress to stderr which is activiated by requiring it and specifying a particular flow function to log or use the main react for global logging of all react modules.
263
-
264
- ```javascript
265
- require('react/lib/log-events').logEvents(react); // turn on logging for all react functions
266
-
267
- // OR
268
-
269
- require('react/lib/log-events').logEvents(myReactFn); // turn on logging for a specific function, repeat for other functions as needed
270
- ```
271
-
272
- #### Automatic Promise Resolution for inputs
273
-
274
- If you want to automatically resolve promises in React without having to manually call `when` or `then`, React provides a plugin which will detect the existence of a `then` method (indicating a promise) at runtime from any inputs to the flow and will internally create `when` tasks to resolve them before passing the values to other tasks.
275
-
276
- ```javascript
277
- require('react/promise-resolve');
176
+ react.logEvents(); // turn on flow and task logging for all react functions
278
177
  ```
279
178
 
280
- #### Track tasks
281
-
282
- Instead of only logging events to stderr (like LogEvents), this plugin fires events that can be directly monitored. The LogEvent plugin uses this internally to get access to the metrics.
283
-
284
- It also provides a simple accumulator which can be used to accumulate events. Note that this accumulator is designed for short term debug use, as it will continue to accumulate events and does not have any size restrictions.
285
-
286
- Thus while the tracking can be used in production because it simply fires events, the accumulator should only be used for convenience in debugging and testing.
287
-
288
- ```javascript
289
- require('react/lib/track-tasks'); // enable tracking and events
290
-
291
- // if you want to use the accumulator
179
+ ### Advanced React
292
180
 
293
- var EventCollector = require('react/lib/track-tasks').EventCollector;
294
- var collector = new EventCollector();
181
+ React has many additional plugins and features which enable logging, monitoring, promise resolution, etc.
295
182
 
296
- collector.captureGlobal('*'); // capture all react events for all flows
183
+ See the [Advanced React](https://github.com/jeffbski/react/blob/master/doc/advanced.md) for details on the AST React uses for processing and other plugins that are available.
297
184
 
298
- // OR
299
-
300
- collector.capture(flowFn, 'task.'); // capture task events on a flow
301
- collector.capture(flowFn, 'flow.'); // add capture flow events on a flow
302
-
303
- var events = collector.list(); // retrieve the list of events
304
- ```
305
-
306
- #### Alternate DSL's
307
-
308
- Additional DSL's can be loaded by requiring them. See the [Alternate DSL](https://github.com/jeffbski/react/blob/master/doc/alternate-dsls.md) page for more info.
309
185
 
310
186
 
311
187
  ## Status
312
188
 
189
+ - 2012-03-28 - Make react AMD-enabled and compatible with ES5 browsers and node.js, provide single file dist and min, add browser tests (v0.6.0)
190
+ - 2012-03-24 - Add Travis-CI, remove promised-io since failing to install in travis-ci for node 0.6/0.7, switch from tap to mocha/chai
191
+ - 2012-03-12 - Pass ast.define events to process (v0.5.2)
192
+ - 2012-01-18 - Remove old DSL interfaces, improve plugin loading, log flow name with task name, ast.defined event, test with node 0.7.0 (v0.5.1)
313
193
  - 2012-01-17 - Additional documentation (v0.3.5)
314
194
  - 2012-01-16 - Refine events and create logging plugin (v0.3.3)
315
195
  - 2012-01-13 - Add promise tasks, promise resolution, refactor alternate DSL interfaces as optional requires (v0.3.0)
@@ -320,32 +200,12 @@ Additional DSL's can be loaded by requiring them. See the [Alternate DSL](https:
320
200
 
321
201
  ## Test Results
322
202
 
203
+ [![Build Status](https://secure.travis-ci.org/jeffbski/react.png?branch=master)](http://travis-ci.org/jeffbski/react)
204
+
323
205
  ```bash
324
- ok ast.test.js .................... 10/10
325
- ok cb-task.test.js ................ 31/31
326
- ok core-deferred.test.js .......... 11/11
327
- ok core-promised.test.js .......... 11/11
328
- ok core-when.test.js ................ 6/6
329
- ok core.test.js ................. 104/104
330
- ok chain.test.js .................. 74/74
331
- ok fstr.test.js ................... 67/67
332
- ok pcode.test.js .................. 94/94
333
- ok dsl.test.js .................... 70/70
334
- ok event-manager.test.js .......... 13/13
335
- ok exec-options.test.js ............. 3/3
336
- ok finalcb-task.test.js ............. 5/5
337
- ok input-parser.test.js ........... 15/15
338
- ok module-use.test.js ............. 21/21
339
- ok promise-auto-resolve.test.js ..... 4/4
340
- ok ret-task.test.js ............... 31/31
341
- ok task.test.js ..................... 1/1
342
- ok validate-cb-task.test.js ......... 6/6
343
- ok validate-ret-task.test.js ........ 7/7
344
- ok validate.test.js ............... 31/31
345
- ok vcon.test.js ................... 55/55
346
- total ........................... 692/692
347
-
348
- ok
206
+ mocha
207
+
208
+ 178 tests complete
349
209
  ```
350
210
 
351
211
  ## License
@@ -0,0 +1,90 @@
1
+ <html>
2
+ <head>
3
+ <meta charset="utf-8">
4
+ <title>Mocha Tests</title>
5
+ <link rel="stylesheet" href="../vendor/mocha/mocha.css" />
6
+ <script type="text/javascript" src="../vendor/jquery/jquery-1.7.1.js"></script>
7
+ <script type="text/javascript" src="../vendor/chai/chai.js"></script>
8
+ <script type="text/javascript" src="../vendor/mocha/mocha.js"></script>
9
+ <script>mocha.setup('qunit')</script>
10
+ <script src="../vendor/requirejs/require.min.js"></script>
11
+ <script type="text/javascript">
12
+ require.config({
13
+ baseUrl: "..",
14
+ packages: [
15
+ {
16
+ name: "react",
17
+ location: "dist",
18
+ main: "react"
19
+ }
20
+ ],
21
+ paths: {
22
+ jQuery: "vendor/jquery/jquery-1.7.1",
23
+ eventemitter2: "dist/react",
24
+ util: "dist/react",
25
+ sprint: "dist/react",
26
+ "ensure-array": "dist/react",
27
+ test: "test"
28
+ }
29
+ });
30
+
31
+ require(["react", "jQuery"],
32
+ function (react, jquery) {
33
+
34
+ require(["react/sprintf", "react/validate", "react/task", "react/cb-task",
35
+ "react/vcon", "react/event-manager", "react/input-parser",
36
+ "react/base-task", "react/ret-task", "util"],
37
+ function (sprintf, validate, taskUtil, CbTask,
38
+ VContext, EventManager, inputParser,
39
+ BaseTask, RetTask, util) {
40
+ // save refs on window for these
41
+ window.react = react;
42
+ window.sprintf = sprintf;
43
+ window.util = util;
44
+ window.validate = validate;
45
+ window.taskUtil = taskUtil;
46
+ window.CbTask = CbTask;
47
+ window.VContext = VContext;
48
+ window.EventManager = EventManager;
49
+ window.inputParser = inputParser;
50
+ window.BaseTask = BaseTask;
51
+ window.RetTask = RetTask;
52
+ window.validate = validate;
53
+ window.Deferred = jQuery.Deferred;
54
+ window.Deferred.when = jQuery.when;
55
+ var testFiles = [
56
+ "test/ast.mocha",
57
+ "test/cb-task.mocha",
58
+ "test/core-deferred.mocha",
59
+ "test/core-when.mocha",
60
+ "test/core.mocha",
61
+ "test/dsl.mocha",
62
+ "test/event-manager.mocha",
63
+ "test/exec-options.mocha",
64
+ "test/finalcb-task.mocha",
65
+ "test/input-parser.mocha",
66
+ "test/module-use.mocha",
67
+ "test/promise-auto-resolve.mocha",
68
+ "test/ret-task.mocha",
69
+ "test/task.mocha",
70
+ "test/validate-cb-task.mocha",
71
+ "test/validate-ret-task.mocha",
72
+ "test/validate.mocha",
73
+ "test/vcon.mocha"
74
+ ];
75
+ require(testFiles, function () {
76
+ var runner = mocha.run().on('end', function () {
77
+ console.log('mocha finished');
78
+ jQuery("#mocha-result").text('completed');
79
+ });
80
+ //mocha.reporters.TAP(runner);
81
+ });
82
+ });
83
+ });
84
+ </script>
85
+ </head>
86
+ <body>
87
+ <div id="mocha"></div>
88
+ <div id="mocha-result"></div>
89
+ </body>
90
+ </html>
@@ -0,0 +1,86 @@
1
+ <html>
2
+ <head>
3
+ <meta charset="utf-8">
4
+ <title>Mocha Tests</title>
5
+ <link rel="stylesheet" href="../vendor/mocha/mocha.css" />
6
+ <script type="text/javascript" src="../vendor/jquery/jquery-1.7.1.js"></script>
7
+ <script type="text/javascript" src="../vendor/chai/chai.js"></script>
8
+ <script type="text/javascript" src="../vendor/mocha/mocha.js"></script>
9
+ <script>mocha.setup('qunit')</script>
10
+ <script src="../vendor/requirejs/require.min.js"></script>
11
+ <script type="text/javascript">
12
+ require.config({
13
+ baseUrl: "..",
14
+ packages: [
15
+ {
16
+ name: "react",
17
+ location: "lib",
18
+ main: "react"
19
+ }
20
+ ],
21
+ paths: {
22
+ jQuery: "vendor/jquery/jquery-1.7.1",
23
+ eventemitter2: "node_modules/eventemitter2/lib/eventemitter2",
24
+ util: "vendor/node/util",
25
+ sprint: "node_modules/sprint/lib/sprint",
26
+ "ensure-array": "node_modules/ensure-array/ensure-array",
27
+ test: "test"
28
+ }
29
+ });
30
+
31
+ require(["react", "react/sprintf", "util", "react/validate", "react/task",
32
+ "react/cb-task", "react/vcon", "react/event-manager", "react/input-parser",
33
+ "react/base-task", "react/ret-task", "react/validate", "jQuery"],
34
+ function (react, sprintf, util, validate, taskUtil,
35
+ CbTask, VContext, EventManager, inputParser,
36
+ BaseTask, RetTask, validate, jquery) {
37
+ // save refs on window for these
38
+ window.react = react;
39
+ window.sprintf = sprintf;
40
+ window.util = util;
41
+ window.validate = validate;
42
+ window.taskUtil = taskUtil;
43
+ window.CbTask = CbTask;
44
+ window.VContext = VContext;
45
+ window.EventManager = EventManager;
46
+ window.inputParser = inputParser;
47
+ window.BaseTask = BaseTask;
48
+ window.RetTask = RetTask;
49
+ window.validate = validate;
50
+ window.Deferred = jQuery.Deferred;
51
+ window.Deferred.when = jQuery.when;
52
+ var testFiles = [
53
+ "test/ast.mocha",
54
+ "test/cb-task.mocha",
55
+ "test/core-deferred.mocha",
56
+ "test/core-when.mocha",
57
+ "test/core.mocha",
58
+ "test/dsl.mocha",
59
+ "test/event-manager.mocha",
60
+ "test/exec-options.mocha",
61
+ "test/finalcb-task.mocha",
62
+ "test/input-parser.mocha",
63
+ "test/module-use.mocha",
64
+ "test/promise-auto-resolve.mocha",
65
+ "test/ret-task.mocha",
66
+ "test/task.mocha",
67
+ "test/validate-cb-task.mocha",
68
+ "test/validate-ret-task.mocha",
69
+ "test/validate.mocha",
70
+ "test/vcon.mocha"
71
+ ];
72
+ require(testFiles, function () {
73
+ var runner = mocha.run().on('end', function () {
74
+ console.log('mocha finished');
75
+ jQuery("#mocha-result").text('completed');
76
+ });
77
+ //mocha.reporters.TAP(runner);
78
+ });
79
+ });
80
+ </script>
81
+ </head>
82
+ <body>
83
+ <div id="mocha"></div>
84
+ <div id="mocha-result"></div>
85
+ </body>
86
+ </html>