traceur-rb 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (410) hide show
  1. checksums.yaml +8 -8
  2. data/README.md +2 -2
  3. data/lib/js/compile.js +7 -15
  4. data/lib/traceur.rb +2 -1
  5. data/lib/traceur/compilation_error.rb +27 -0
  6. data/lib/traceur/compiler.rb +4 -1
  7. data/lib/traceur/configuration.rb +1 -1
  8. data/lib/traceur/node/runner.rb +1 -1
  9. data/lib/traceur/version.rb +1 -1
  10. data/spec/examples/syntax_error.js +3 -0
  11. data/spec/integration/examples_spec.rb +6 -0
  12. data/vendor/node_modules/traceur/LICENSE +202 -0
  13. data/vendor/node_modules/traceur/README.md +5 -5
  14. data/vendor/node_modules/traceur/bin/traceur-runtime.js +1392 -623
  15. data/vendor/node_modules/traceur/bin/traceur.js +24749 -17990
  16. data/vendor/node_modules/traceur/node_modules/.bin/semver +2 -2
  17. data/vendor/node_modules/traceur/node_modules/commander/History.md +222 -0
  18. data/vendor/node_modules/traceur/node_modules/commander/Readme.md +127 -35
  19. data/vendor/node_modules/traceur/node_modules/commander/index.js +261 -93
  20. data/vendor/node_modules/traceur/node_modules/commander/package.json +41 -9
  21. data/vendor/node_modules/traceur/node_modules/glob/LICENSE +15 -0
  22. data/vendor/node_modules/traceur/node_modules/glob/README.md +357 -0
  23. data/vendor/node_modules/traceur/node_modules/glob/common.js +177 -0
  24. data/vendor/node_modules/traceur/node_modules/glob/glob.js +649 -0
  25. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/.eslintrc +17 -0
  26. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/LICENSE +15 -0
  27. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/README.md +37 -0
  28. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/inflight.js +44 -0
  29. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE +15 -0
  30. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md +36 -0
  31. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json +34 -0
  32. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js +51 -0
  33. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js +33 -0
  34. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/package.json +61 -0
  35. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/test.js +97 -0
  36. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/LICENSE +16 -0
  37. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/README.md +42 -0
  38. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/inherits.js +1 -0
  39. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/inherits_browser.js +23 -0
  40. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/package.json +33 -0
  41. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/test.js +25 -0
  42. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/.npmignore +1 -0
  43. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/.travis.yml +4 -0
  44. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/LICENSE +23 -0
  45. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/README.md +216 -0
  46. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/benchmark.js +15 -0
  47. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/browser.js +1181 -0
  48. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/minimatch.js +845 -0
  49. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +2 -0
  50. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml +3 -0
  51. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +121 -0
  52. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js +8 -0
  53. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +191 -0
  54. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +2 -0
  55. data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/collections → glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match}/.travis.yml +0 -0
  56. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +6 -0
  57. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +80 -0
  58. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +5 -0
  59. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +38 -0
  60. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +73 -0
  61. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +56 -0
  62. data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/url2 → glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map}/.travis.yml +1 -1
  63. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE +18 -0
  64. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown +62 -0
  65. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js +6 -0
  66. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js +13 -0
  67. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +83 -0
  68. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js +39 -0
  69. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +75 -0
  70. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js +32 -0
  71. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt +1075 -0
  72. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt +182 -0
  73. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js +9 -0
  74. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js +10 -0
  75. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh +24 -0
  76. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js +15 -0
  77. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js +16 -0
  78. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js +10 -0
  79. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js +13 -0
  80. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js +7 -0
  81. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js +50 -0
  82. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/package.json +60 -0
  83. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/basic.js +399 -0
  84. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/brace-expand.js +45 -0
  85. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/defaults.js +274 -0
  86. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
  87. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/LICENSE +27 -0
  88. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/README.md +51 -0
  89. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE +15 -0
  90. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/README.md +36 -0
  91. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/package.json +34 -0
  92. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js +51 -0
  93. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js +33 -0
  94. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/once.js +21 -0
  95. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/package.json +42 -0
  96. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/test/once.js +23 -0
  97. data/vendor/node_modules/traceur/node_modules/glob/package.json +72 -0
  98. data/vendor/node_modules/traceur/node_modules/glob/sync.js +409 -0
  99. data/vendor/node_modules/traceur/node_modules/rsvp/.release.json +17 -0
  100. data/vendor/node_modules/traceur/node_modules/rsvp/CHANGELOG.md +165 -0
  101. data/vendor/node_modules/traceur/node_modules/rsvp/LICENSE +19 -0
  102. data/vendor/node_modules/traceur/node_modules/rsvp/README.md +364 -0
  103. data/vendor/node_modules/traceur/node_modules/rsvp/dist/rsvp.js +1671 -0
  104. data/vendor/node_modules/traceur/node_modules/rsvp/dist/rsvp.min.js +9 -0
  105. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp.js +66 -0
  106. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp.umd.js +50 -0
  107. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/-internal.js +265 -0
  108. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/all-settled.js +71 -0
  109. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/all.js +15 -0
  110. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/asap.js +109 -0
  111. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/config.js +28 -0
  112. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/defer.js +45 -0
  113. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/enumerator.js +125 -0
  114. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/events.js +201 -0
  115. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/filter.js +120 -0
  116. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash-settled.js +124 -0
  117. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash.js +94 -0
  118. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/instrument.js +41 -0
  119. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/map.js +99 -0
  120. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/node.js +281 -0
  121. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise-hash.js +51 -0
  122. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise.js +496 -0
  123. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/all.js +52 -0
  124. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/race.js +105 -0
  125. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/reject.js +47 -0
  126. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/resolve.js +49 -0
  127. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/race.js +15 -0
  128. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/reject.js +16 -0
  129. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/resolve.js +17 -0
  130. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/rethrow.js +46 -0
  131. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/utils.js +39 -0
  132. data/vendor/node_modules/traceur/node_modules/rsvp/package.json +100 -0
  133. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/README.md +9 -0
  134. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/bower.json +22 -0
  135. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/composer.json +18 -0
  136. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/package.json +52 -0
  137. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.amd.js +1607 -0
  138. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.js +1566 -0
  139. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.min.js +26 -0
  140. data/vendor/node_modules/traceur/node_modules/rsvp/vertx.js +1 -0
  141. data/vendor/node_modules/traceur/node_modules/semver/bin/semver +2 -2
  142. data/vendor/node_modules/traceur/node_modules/semver/package.json +4 -3
  143. data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js +7 -0
  144. data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js.gz +0 -0
  145. data/vendor/node_modules/traceur/node_modules/semver/semver.js +7 -0
  146. data/vendor/node_modules/traceur/node_modules/semver/semver.min.js +1 -1
  147. data/vendor/node_modules/traceur/node_modules/semver/semver.min.js.gz +0 -0
  148. data/vendor/node_modules/traceur/node_modules/semver/test/index.js +8 -4
  149. data/vendor/node_modules/traceur/node_modules/semver/test/ltr.js +2 -1
  150. data/vendor/node_modules/traceur/node_modules/source-map-support/.npmignore +1 -0
  151. data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/mime/LICENSE → source-map-support/LICENSE.md} +7 -5
  152. data/vendor/node_modules/traceur/node_modules/source-map-support/README.md +165 -0
  153. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/browser-source-map-support.js +89 -0
  154. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/index.html +6 -0
  155. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/require.js +36 -0
  156. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.coffee +13 -0
  157. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.js +24 -0
  158. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.map +10 -0
  159. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-source-map-support.js +89 -0
  160. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/index.html +6 -0
  161. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.coffee +12 -0
  162. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.js +25 -0
  163. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.map +10 -0
  164. data/vendor/node_modules/traceur/node_modules/source-map-support/build.js +69 -0
  165. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/index.html +6 -0
  166. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.coffee +12 -0
  167. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.js +25 -0
  168. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.map +10 -0
  169. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/server.js +45 -0
  170. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/.npmignore +2 -0
  171. data/vendor/node_modules/traceur/node_modules/{q-io → source-map-support/node_modules/source-map}/.travis.yml +1 -0
  172. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/CHANGELOG.md +121 -0
  173. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/LICENSE +28 -0
  174. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/Makefile.dryice.js +166 -0
  175. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/README.md +434 -0
  176. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/assert-shim.js +56 -0
  177. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/mini-require.js +152 -0
  178. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-source-map.jsm +20 -0
  179. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-utils.jsm +18 -0
  180. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-browser.js +8 -0
  181. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-source-map.jsm +6 -0
  182. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-utils.jsm +21 -0
  183. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/test-prefix.js +8 -0
  184. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/test-suffix.js +3 -0
  185. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map.js +8 -0
  186. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/array-set.js +97 -0
  187. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64-vlq.js +144 -0
  188. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64.js +42 -0
  189. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/binary-search.js +81 -0
  190. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-consumer.js +478 -0
  191. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-generator.js +380 -0
  192. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-node.js +371 -0
  193. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/util.js +205 -0
  194. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
  195. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/README.md +171 -0
  196. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
  197. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/intercept.js +36 -0
  198. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/package.json +37 -0
  199. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/package.json +142 -0
  200. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/run-tests.js +62 -0
  201. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-api.js +26 -0
  202. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-array-set.js +104 -0
  203. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64-vlq.js +24 -0
  204. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64.js +35 -0
  205. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
  206. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-dog-fooding.js +72 -0
  207. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-consumer.js +451 -0
  208. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-generator.js +417 -0
  209. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-node.js +365 -0
  210. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/util.js +161 -0
  211. data/vendor/node_modules/traceur/node_modules/source-map-support/package.json +52 -0
  212. data/vendor/node_modules/traceur/node_modules/source-map-support/source-map-support.js +381 -0
  213. data/vendor/node_modules/traceur/node_modules/source-map-support/test.js +359 -0
  214. data/vendor/node_modules/traceur/package.json +234 -20
  215. data/vendor/node_modules/traceur/src/node/NodeCompiler.js +78 -0
  216. data/vendor/node_modules/traceur/src/node/System.js +32 -5
  217. data/vendor/node_modules/traceur/src/node/api.js +28 -93
  218. data/vendor/node_modules/traceur/src/node/command.js +84 -19
  219. data/vendor/node_modules/traceur/src/node/compileAllJsFilesInDir.js +40 -0
  220. data/vendor/node_modules/traceur/src/node/interpreter.js +11 -8
  221. data/vendor/node_modules/traceur/src/node/recursiveModuleCompile.js +171 -0
  222. data/vendor/node_modules/traceur/src/node/require.js +7 -21
  223. data/vendor/node_modules/traceur/src/node/to-amd-compiler.js +2 -7
  224. data/vendor/node_modules/traceur/src/node/to-closure-compiler.js +28 -0
  225. data/vendor/node_modules/traceur/src/node/to-commonjs-compiler.js +3 -7
  226. data/vendor/node_modules/traceur/src/node/traceur.js +1 -1
  227. metadata +196 -190
  228. data/vendor/node_modules/traceur/node_modules/q-io/.npmignore +0 -1
  229. data/vendor/node_modules/traceur/node_modules/q-io/CHANGES.md +0 -122
  230. data/vendor/node_modules/traceur/node_modules/q-io/LICENSE +0 -19
  231. data/vendor/node_modules/traceur/node_modules/q-io/README.md +0 -928
  232. data/vendor/node_modules/traceur/node_modules/q-io/buffer-stream.js +0 -59
  233. data/vendor/node_modules/traceur/node_modules/q-io/coverage-report.js +0 -44
  234. data/vendor/node_modules/traceur/node_modules/q-io/deprecate.js +0 -51
  235. data/vendor/node_modules/traceur/node_modules/q-io/fs-boot.js +0 -307
  236. data/vendor/node_modules/traceur/node_modules/q-io/fs-common.js +0 -499
  237. data/vendor/node_modules/traceur/node_modules/q-io/fs-mock.js +0 -547
  238. data/vendor/node_modules/traceur/node_modules/q-io/fs-root.js +0 -105
  239. data/vendor/node_modules/traceur/node_modules/q-io/fs.js +0 -355
  240. data/vendor/node_modules/traceur/node_modules/q-io/fs2http.js +0 -65
  241. data/vendor/node_modules/traceur/node_modules/q-io/http-apps.js +0 -152
  242. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/chain.js +0 -24
  243. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/content.js +0 -93
  244. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/cookie.js +0 -154
  245. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/decorators.js +0 -178
  246. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/fs.js +0 -417
  247. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/html.js +0 -58
  248. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/json.js +0 -78
  249. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/negotiate.js +0 -120
  250. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/proxy.js +0 -27
  251. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/redirect.js +0 -209
  252. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/route.js +0 -125
  253. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/status.js +0 -175
  254. data/vendor/node_modules/traceur/node_modules/q-io/http-cookie.js +0 -75
  255. data/vendor/node_modules/traceur/node_modules/q-io/http.js +0 -378
  256. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.npmignore +0 -11
  257. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/CHANGES.md +0 -78
  258. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/LICENSE.md +0 -21
  259. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/README.md +0 -1285
  260. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/collections.js +0 -22
  261. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/dict.js +0 -142
  262. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-map.js +0 -57
  263. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-set.js +0 -183
  264. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-collection.js +0 -261
  265. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-map.js +0 -186
  266. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-order.js +0 -55
  267. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-set.js +0 -59
  268. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/heap.js +0 -236
  269. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/iterator.js +0 -371
  270. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/list.js +0 -435
  271. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/array-changes.js +0 -247
  272. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/map-changes.js +0 -147
  273. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/property-changes.js +0 -448
  274. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/range-changes.js +0 -139
  275. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-map.js +0 -79
  276. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-set.js +0 -142
  277. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/map.js +0 -60
  278. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/multi-map.js +0 -41
  279. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/package.json +0 -12
  280. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync +0 -7
  281. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync.patch +0 -48
  282. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/weak-map.js +0 -590
  283. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/package.json +0 -49
  284. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/set.js +0 -173
  285. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-array.js +0 -274
  286. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-function.js +0 -59
  287. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-object.js +0 -538
  288. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-regexp.js +0 -14
  289. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim.js +0 -6
  290. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-map.js +0 -49
  291. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-set.js +0 -51
  292. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array.js +0 -269
  293. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-map.js +0 -61
  294. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-set.js +0 -736
  295. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/tree-log.js +0 -40
  296. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/weak-map.js +0 -1
  297. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/README.md +0 -66
  298. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/mime.js +0 -114
  299. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/package.json +0 -35
  300. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/test.js +0 -84
  301. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/mime.types +0 -1588
  302. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/node.types +0 -77
  303. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/CHANGES +0 -15
  304. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/LICENSE +0 -19
  305. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/README +0 -96
  306. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/lib/mimeparse.js +0 -166
  307. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/package.json +0 -43
  308. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/CONTRIBUTING.md +0 -40
  309. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/LICENSE +0 -19
  310. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/README.md +0 -813
  311. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/compare-with-callbacks.js +0 -71
  312. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/scenarios.js +0 -36
  313. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/package.json +0 -93
  314. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/q.js +0 -1937
  315. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/queue.js +0 -35
  316. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/.gitmodules +0 -6
  317. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/History.md +0 -36
  318. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Makefile +0 -7
  319. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Readme.md +0 -38
  320. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/benchmark.js +0 -32
  321. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/examples.js +0 -39
  322. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/index.js +0 -2
  323. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/lib/querystring.js +0 -123
  324. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/package.json +0 -19
  325. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.gitmodules +0 -3
  326. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.npmignore +0 -3
  327. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/History.md +0 -128
  328. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Makefile +0 -53
  329. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Readme.md +0 -61
  330. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/bin/expresso +0 -856
  331. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/api.html +0 -1080
  332. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.html +0 -377
  333. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.md +0 -290
  334. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/foot.html +0 -3
  335. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/head.html +0 -42
  336. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/bar.js +0 -4
  337. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/foo.js +0 -16
  338. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/package.json +0 -12
  339. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/assert.test.js +0 -91
  340. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/async.test.js +0 -12
  341. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/bar.test.js +0 -13
  342. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/foo.test.js +0 -14
  343. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/http.test.js +0 -146
  344. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/async.test.js +0 -39
  345. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/http.test.js +0 -48
  346. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/.gitmodules +0 -3
  347. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/History.md +0 -22
  348. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Makefile +0 -6
  349. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Readme.md +0 -248
  350. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/examples/runner.js +0 -53
  351. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/index.js +0 -2
  352. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/eql.js +0 -91
  353. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/should.js +0 -548
  354. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/package.json +0 -8
  355. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/test/should.test.js +0 -358
  356. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/test/querystring.test.js +0 -133
  357. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.npmignore +0 -3
  358. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/LICENSE.md +0 -20
  359. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/README.md +0 -33
  360. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/package.json +0 -37
  361. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/test/url2-spec.js +0 -125
  362. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/url2.js +0 -151
  363. data/vendor/node_modules/traceur/node_modules/q-io/package.json +0 -51
  364. data/vendor/node_modules/traceur/node_modules/q-io/reader.js +0 -133
  365. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/boot-directory-spec.js +0 -47
  366. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/contains-spec.js +0 -11
  367. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/fixtures/hello.txt +0 -1
  368. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/issues/1-spec.js +0 -33
  369. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/make-tree-spec.js +0 -92
  370. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/append-spec.js +0 -41
  371. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/copy-tree-spec.js +0 -57
  372. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/fixture/hello.txt +0 -1
  373. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/link-spec.js +0 -70
  374. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/make-tree-spec.js +0 -109
  375. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/merge-spec.js +0 -67
  376. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/move-spec.js +0 -219
  377. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/object-spec.js +0 -20
  378. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/range-spec.js +0 -26
  379. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/read-spec.js +0 -40
  380. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-directory-spec.js +0 -37
  381. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-tree-spec.js +0 -39
  382. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/root-spec.js +0 -32
  383. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/stat-spec.js +0 -26
  384. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/symbolic-link-spec.js +0 -86
  385. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/working-directory-spec.js +0 -31
  386. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/write-spec.js +0 -73
  387. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.js +0 -23
  388. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.txt +0 -1
  389. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/read-spec.js +0 -22
  390. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/relative-spec.js +0 -25
  391. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/reroot-spec.js +0 -45
  392. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/write-spec.js +0 -38
  393. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/cookie-spec.js +0 -52
  394. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/directory-list-spec.js +0 -86
  395. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/01234.txt +0 -1
  396. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/1234.txt +0 -1
  397. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/5678.txt +0 -0
  398. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/9012/3456.txt +0 -0
  399. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/hosts-spec.js +0 -49
  400. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/interpret-range-spec.js +0 -47
  401. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/partial-range-spec.js +0 -186
  402. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/proxy-spec.js +0 -82
  403. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/symbolic-link-spec.js +0 -110
  404. data/vendor/node_modules/traceur/node_modules/q-io/spec/http/agent-spec.js +0 -96
  405. data/vendor/node_modules/traceur/node_modules/q-io/spec/http/basic-spec.js +0 -96
  406. data/vendor/node_modules/traceur/node_modules/q-io/spec/lib/jasmine-promise.js +0 -42
  407. data/vendor/node_modules/traceur/node_modules/q-io/writer.js +0 -111
  408. data/vendor/node_modules/traceur/src/node/compile-single-file.js +0 -69
  409. data/vendor/node_modules/traceur/src/node/compiler.js +0 -116
  410. data/vendor/node_modules/traceur/src/node/inline-module.js +0 -149
@@ -1,125 +0,0 @@
1
-
2
- var Q = require("q");
3
- var StatusApps = require("./status");
4
-
5
- /**
6
- * Makes a Q-JSGI app that only responds when there is nothing left
7
- * on the path to route. If the there is unprocessed data on the
8
- * path, the returned app either forwards to the `notFound` app or
9
- * returns a `404 Not Found` response.
10
- *
11
- * @param {App} app a Q-JSGI application to
12
- * respond to this end of the routing chain.
13
- * @param {App} notFound (optional) defaults
14
- * to the `notFound` app.
15
- * @returns {App}
16
- */
17
- exports.Cap = function (app, notFound) {
18
- notFound = notFound || StatusApps.notFound;
19
- return function (request, response) {
20
- // TODO Distinguish these cases
21
- if (request.pathInfo === "" || request.pathInfo === "/") {
22
- return app(request, response);
23
- } else {
24
- return notFound(request, response);
25
- }
26
- };
27
- };
28
-
29
- /**
30
- * Wraps an app with a function that will observe incoming requests
31
- * before giving the app an opportunity to respond. If the "tap"
32
- * function returns a response, it will be used in lieu of forwarding
33
- * the request to the wrapped app.
34
- */
35
- exports.Tap = function (app, tap) {
36
- return function (request, response) {
37
- var self = this, args = arguments;
38
- return Q.when(tap.apply(this, arguments), function (response) {
39
- if (response) {
40
- return response;
41
- } else {
42
- return app.apply(self, args);
43
- }
44
- });
45
- };
46
- };
47
-
48
- /**
49
- * Wraps an app with a "trap" function that intercepts and may
50
- * alter or replace the response of the wrapped application.
51
- */
52
- exports.Trap = function (app, trap) {
53
- return function (request, response) {
54
- return Q.when(app.apply(this, arguments), function (response) {
55
- if (response) {
56
- response.headers = response.headers || {};
57
- return trap(response, request) || response;
58
- }
59
- });
60
- };
61
- };
62
-
63
- /**
64
- * Makes a Q-JSGI app that branches requests based on the next
65
- * unprocessed path component.
66
- * @param {Object * App} paths a mapping from path components (single
67
- * file or directory names) to Q-JSGI applications for subsequent
68
- * routing. The mapping may be a plain JavaScript `Object` record,
69
- * which must own the mapping properties, or an object that has
70
- * `has(key)` and `get(key)` methods in its prototype chain.
71
- * @param {App} notFound a Q-JSGI application
72
- * that handles requests for which the next file name does not exist
73
- * in paths.
74
- * @returns {App}
75
- */
76
- exports.Branch = function (paths, notFound) {
77
- if (!paths)
78
- paths = {};
79
- if (!notFound)
80
- notFound = StatusApps.notFound;
81
- return function (request, response) {
82
- if (!/^\//.test(request.pathInfo)) {
83
- return notFound(request, response);
84
- }
85
- var path = request.pathInfo.slice(1);
86
- var parts = path.split("/");
87
- var part = decodeURIComponent(parts.shift());
88
- if (Object.has(paths, part)) {
89
- request.scriptName = request.scriptName + part + "/";
90
- request.pathInfo = path.slice(part.length);
91
- return Object.get(paths, part)(request, response);
92
- }
93
- return notFound(request, response);
94
- };
95
- };
96
-
97
- /**
98
- * Returns the response of the first application that returns a
99
- * non-404 response status.
100
- *
101
- * @param {Array * App} apps a cascade of applications to try
102
- * successively until one of them returns a non-404 status.
103
- * @returns {App}
104
- */
105
- exports.FirstFound = function (cascade) {
106
- return function (request, response) {
107
- var i = 0, ii = cascade.length;
108
- function next() {
109
- var response = cascade[i++](request, response);
110
- if (i < ii) {
111
- return Q.when(response, function (response) {
112
- if (response.status === 404) {
113
- return next();
114
- } else {
115
- return response;
116
- }
117
- });
118
- } else {
119
- return response;
120
- }
121
- }
122
- return next();
123
- };
124
- };
125
-
@@ -1,175 +0,0 @@
1
-
2
- var Negotiation = require("./negotiate");
3
- var HtmlApps = require("./html");
4
-
5
- /**
6
- * {Object * String} a mapping of HTTP status codes to
7
- * their standard descriptions.
8
- */
9
- // Every standard HTTP code mapped to the appropriate message.
10
- // Stolen from Rack which stole from Mongrel
11
- exports.statusCodes = {
12
- 100: 'Continue',
13
- 101: 'Switching Protocols',
14
- 102: 'Processing',
15
- 200: 'OK',
16
- 201: 'Created',
17
- 202: 'Accepted',
18
- 203: 'Non-Authoritative Information',
19
- 204: 'No Content',
20
- 205: 'Reset Content',
21
- 206: 'Partial Content',
22
- 207: 'Multi-Status',
23
- 300: 'Multiple Choices',
24
- 301: 'Moved Permanently',
25
- 302: 'Found',
26
- 303: 'See Other',
27
- 304: 'Not Modified',
28
- 305: 'Use Proxy',
29
- 307: 'Temporary Redirect',
30
- 400: 'Bad Request',
31
- 401: 'Unauthorized',
32
- 402: 'Payment Required',
33
- 403: 'Forbidden',
34
- 404: 'Not Found',
35
- 405: 'Method Not Allowed',
36
- 406: 'Not Acceptable',
37
- 407: 'Proxy Authentication Required',
38
- 408: 'Request Timeout',
39
- 409: 'Conflict',
40
- 410: 'Gone',
41
- 411: 'Length Required',
42
- 412: 'Precondition Failed',
43
- 413: 'Request Entity Too Large',
44
- 414: 'Request-URI Too Large',
45
- 415: 'Unsupported Media Type',
46
- 416: 'Request Range Not Satisfiable',
47
- 417: 'Expectation Failed',
48
- 422: 'Unprocessable Entity',
49
- 423: 'Locked',
50
- 424: 'Failed Dependency',
51
- 500: 'Internal Server Error',
52
- 501: 'Not Implemented',
53
- 502: 'Bad Gateway',
54
- 503: 'Service Unavailable',
55
- 504: 'Gateway Timeout',
56
- 505: 'HTTP Version Not Supported',
57
- 507: 'Insufficient Storage'
58
- };
59
-
60
- /**
61
- * {Object * Number} a mapping from HTTP status descriptions
62
- * to HTTP status codes.
63
- */
64
- exports.statusMessages = {};
65
- for (var code in exports.statusCodes)
66
- exports.statusMessages[exports.statusCodes[code]] = +code;
67
-
68
- /**
69
- * Determines whether an HTTP response should have a
70
- * response body, based on its status code.
71
- * @param {Number} status
72
- * @returns whether the HTTP response for the given status
73
- * code has content.
74
- */
75
- exports.statusWithNoEntityBody = function (status) {
76
- return (status >= 100 && status <= 199) ||
77
- status == 204 || status == 304;
78
- };
79
-
80
- /**
81
- * @param {Number} status
82
- * @returns {Function(Request) :Response} a JSGI app that returns
83
- * a plain text response with the given status code.
84
- */
85
- exports.appForStatus = function (status) {
86
- return function (request) {
87
- return exports.responseForStatus(request, status, request.method + " " + request.path);
88
- };
89
- };
90
-
91
- /**
92
- * @param {Number} status an HTTP status code
93
- * @param {String} message (optional) a message to include
94
- * in the response body.
95
- * @returns a JSGI HTTP response object with the given status
96
- * code and message as its body, if the status supports
97
- * a body.
98
- */
99
- exports.responseForStatus = function(request, status, addendum) {
100
- if (exports.statusCodes[status] === undefined)
101
- throw "Unknown status code";
102
-
103
- var message = exports.statusCodes[status];
104
-
105
- // RFC 2616, 10.2.5:
106
- // The 204 response MUST NOT include a message-body, and thus is always
107
- // terminated by the first empty line after the header fields.
108
- // RFC 2616, 10.3.5:
109
- // The 304 response MUST NOT contain a message-body, and thus is always
110
- // terminated by the first empty line after the header fields.
111
- if (exports.statusWithNoEntityBody(status)) {
112
- return {status: status, headers: {}};
113
- } else {
114
- var handlers = {};
115
- handlers["text/plain"] = exports.textResponseForStatus;
116
- if (request.handleHtmlFragmentResponse) {
117
- handlers["text/html"] = exports.htmlResponseForStatus;
118
- }
119
- var responseForStatus = Negotiation.negotiate(request, handlers) || exports.textResponseForStatus;
120
- return responseForStatus(request, status, message, addendum);
121
- }
122
- };
123
-
124
- exports.textResponseForStatus = function (request, status, message, addendum) {
125
- var content = message + "\n";
126
- if (addendum) {
127
- content += addendum + "\n";
128
- }
129
- var contentLength = content.length;
130
- return {
131
- status: status,
132
- statusMessage: message,
133
- headers: {
134
- "content-length": contentLength
135
- },
136
- body: [content]
137
- };
138
- };
139
-
140
- exports.htmlResponseForStatus = function (request, status, message, addendum) {
141
- return {
142
- status: status,
143
- statusMessage: message,
144
- headers: {},
145
- htmlTitle: message,
146
- htmlFragment: {
147
- forEach: function (write) {
148
- write("<h1>" + HtmlApps.escapeHtml(message) + "</h1>\n");
149
- write("<p>Status: " + status + "</p>\n");
150
- if (addendum) {
151
- write("<pre>" + HtmlApps.escapeHtml(addendum) + "</pre>\n");
152
- }
153
- }
154
- }
155
- }
156
- };
157
-
158
- /**
159
- * {App} an application that returns a 400 response.
160
- */
161
- exports.badRequest = exports.appForStatus(400);
162
- /**
163
- * {App} an application that returns a 404 response.
164
- */
165
- exports.notFound = exports.appForStatus(404);
166
- /**
167
- * {App} an application that returns a 405 response.
168
- */
169
- exports.methodNotAllowed = exports.appForStatus(405);
170
- /**
171
- * {App} an application that returns a 405 response.
172
- */
173
- exports.noLanguage =
174
- exports.notAcceptable = exports.appForStatus(406);
175
-
@@ -1,75 +0,0 @@
1
-
2
- /**
3
- * Provides utilities for reading and writing HTTP cookies.
4
- * @module
5
- */
6
-
7
- /*whatsupdoc*/
8
-
9
- var QS = require("qs");
10
-
11
- /**
12
- * @param {String} cookie
13
- * @returns {Object}
14
- */
15
- exports.parse = function (cookie, date) {
16
- date = date || new Date();
17
- var parsed = {};
18
- var terms = cookie.split(/[;,]/g);
19
- var keyValue = terms.shift().split("=");
20
- parsed.key = keyValue[0];
21
- parsed.value = keyValue[1];
22
- terms.forEach(function (term) {
23
- var parts = term.split("=").map(function (part) {
24
- return part.trim();
25
- });
26
- var key = parts[0], value = parts[1];
27
- if (/^domain$/i.test(key)) {
28
- parsed.domain = value;
29
- } else if (/^path$/i.test(key)) {
30
- parsed.path = value;
31
- } else if (/^expires$/i.test(key)) {
32
- parsed.expires = new Date(
33
- +new Date() + // actual now
34
- (new Date(value) - date) // server offset
35
- );
36
- } else if (/^max-age$/i.test(key)) {
37
- parsed.expires = new Date(
38
- new Date().getTime() +
39
- (value * 1000)
40
- );
41
- } else if (/^secure$/i.test(key)) {
42
- parsed.secure = true;
43
- } else if (/^httponly$/i.test(key)) {
44
- parsed.httpOnly = true;
45
- }
46
- });
47
- return parsed;
48
- };
49
-
50
- /**
51
- * @param {String} key
52
- * @param {String} value
53
- * @param {Object} options (optional)
54
- * @returns {String} a cookie string
55
- */
56
- exports.stringify = function (key, value, options) {
57
- var cookie = (
58
- encodeURIComponent(key) + "=" +
59
- encodeURIComponent(value)
60
- );
61
- if (options) {
62
- if (options.domain)
63
- cookie += "; Domain=" + encodeURIComponent(options.domain);
64
- if (options.path)
65
- cookie += "; Path=" + encodeURIComponent(options.path);
66
- if (options.expires)
67
- cookie += "; Expires=" + options.expires.toGMTString();
68
- if (options.secure)
69
- cookie += "; Secure";
70
- if (options.httpOnly)
71
- cookie += "; HttpOnly";
72
- }
73
- return cookie;
74
- };
75
-
@@ -1,378 +0,0 @@
1
- /**
2
- * A promise-based Q-JSGI server and client API.
3
- * @module
4
- */
5
-
6
- /*whatsupdoc*/
7
-
8
- var HTTP = require("http"); // node
9
- var HTTPS = require("https"); // node
10
- var URL = require("url2"); // node
11
- var Q = require("q");
12
- var Reader = require("./reader");
13
-
14
- /**
15
- * @param {respond(request Request)} respond a JSGI responder function that
16
- * receives a Request object as its argument. The JSGI responder promises to
17
- * return an object of the form `{status, headers, body}`. The status and
18
- * headers must be fully resolved, but the body may be a promise for an object
19
- * with a `forEach(write(chunk String))` method, albeit an array of strings.
20
- * The `forEach` method may promise to resolve when all chunks have been
21
- * written.
22
- * @returns a Node Server object.
23
- */
24
- exports.Server = function (respond) {
25
- var self = Object.create(exports.Server.prototype);
26
-
27
- var server = HTTP.createServer(function (_request, _response) {
28
- var request = exports.ServerRequest(_request);
29
- var response = exports.ServerResponse(_response);
30
-
31
- var closed = Q.defer();
32
- _request.on("end", function (error, value) {
33
- if (error) {
34
- closed.reject(error);
35
- } else {
36
- closed.resolve(value);
37
- }
38
- });
39
-
40
- Q.when(request, function (request) {
41
- return Q.when(respond(request, response), function (response) {
42
- if (!response)
43
- return;
44
-
45
- _response.writeHead(response.status, response.headers);
46
-
47
- if (response.onclose || response.onClose)
48
- Q.when(closed, response.onclose || response.onClose);
49
-
50
- return Q.when(response.body, function (body) {
51
- var length;
52
- if (
53
- Array.isArray(body) &&
54
- (length = body.length) &&
55
- body.every(function (chunk) {
56
- return typeof chunk === "string"
57
- })
58
- ) {
59
- body.forEach(function (chunk, i) {
60
- if (i < length - 1) {
61
- _response.write(chunk, response.charset);
62
- } else {
63
- _response.end(chunk, response.charset);
64
- }
65
- });
66
- } else if (body) {
67
- var end;
68
- var done = body.forEach(function (chunk) {
69
- end = Q.when(end, function () {
70
- return Q.when(chunk, function (chunk) {
71
- _response.write(chunk, response.charset);
72
- });
73
- });
74
- });
75
- return Q.when(done, function () {
76
- return Q.when(end, function () {
77
- _response.end();
78
- });
79
- });
80
- } else {
81
- _response.end();
82
- }
83
- });
84
-
85
- })
86
- })
87
- .done(); // should be .fail(self.emitter("error"))
88
-
89
- });
90
-
91
- var stopped = Q.defer();
92
- server.on("close", function (err) {
93
- if (err) {
94
- stopped.reject(err);
95
- } else {
96
- stopped.resolve();
97
- }
98
- });
99
-
100
- /***
101
- * Stops the server.
102
- * @returns {Promise * Undefined} a promise that will
103
- * resolve when the server is stopped.
104
- */
105
- self.stop = function () {
106
- server.close();
107
- listening = undefined;
108
- return stopped.promise;
109
- };
110
-
111
- var listening = Q.defer();
112
- server.on("listening", function (err) {
113
- if (err) {
114
- listening.reject(err);
115
- } else {
116
- listening.resolve(self);
117
- }
118
- });
119
-
120
- /***
121
- * Starts the server, listening on the given port
122
- * @param {Number} port
123
- * @returns {Promise * Undefined} a promise that will
124
- * resolve when the server is ready to receive
125
- * connections
126
- */
127
- self.listen = function (/*...args*/) {
128
- if (typeof server.port !== "undefined")
129
- return Q.reject(new Error("A server cannot be restarted or " +
130
- "started on a new port"));
131
- server.listen.apply(server, arguments);
132
- return listening.promise;
133
- };
134
-
135
- self.stopped = stopped.promise;
136
-
137
- self.node = server;
138
- self.nodeServer = server; // Deprecated
139
- self.address = server.address.bind(server);
140
-
141
- return self;
142
- };
143
-
144
- Object.defineProperties(exports.Server, {
145
-
146
- port: {
147
- get: function () {
148
- return this.node.port;
149
- }
150
- },
151
-
152
- host: {
153
- get: function () {
154
- return this.node.host;
155
- }
156
- }
157
-
158
- });
159
-
160
- /**
161
- * A wrapper for a Node HTTP Request, as received by
162
- * the Q HTTP Server, suitable for use by the Q HTTP Client.
163
- */
164
- exports.ServerRequest = function (_request, ssl) {
165
- var request = Object.create(_request);
166
- /*** {Array} HTTP version. (JSGI) */
167
- request.version = _request.httpVersion.split(".").map(Math.floor);
168
- /*** {String} HTTP method, e.g., `"GET"` (JSGI) */
169
- request.method = _request.method;
170
- /*** {String} path, starting with `"/"` */
171
- request.path = _request.url;
172
- /*** {String} pathInfo, starting with `"/"`, the
173
- * portion of the path that has not yet
174
- * been routed (JSGI) */
175
- request.pathInfo = URL.parse(_request.url).pathname;
176
- /*** {String} scriptName, the portion of the path that
177
- * has already been routed (JSGI) */
178
- request.scriptName = "";
179
- /*** {String} (JSGI) */
180
- request.scheme = "http";
181
-
182
- var address = _request.connection.address();
183
- /*** {String} hostname */
184
- if (_request.headers.host) {
185
- request.hostname = _request.headers.host.split(":")[0];
186
- } else {
187
- request.hostname = address.address;
188
- }
189
- /*** {String} host */
190
- request.host = request.hostname + ":" + address.port;
191
- request.port = address.port;
192
-
193
- var socket = _request.socket;
194
- /*** {String} */
195
- request.remoteHost = socket.remoteAddress;
196
- /*** {Number} */
197
- request.remotePort = socket.remotePort;
198
-
199
- /*** {String} url */
200
- request.url = URL.format({
201
- protocol: request.scheme,
202
- host: _request.headers.host,
203
- port: request.port === (ssl ? 443 : 80) ? null : request.port,
204
- path: request.path
205
- });
206
- /*** A Q IO asynchronous text reader */
207
- request.body = Reader(_request);
208
- /*** {Object} HTTP headers (JSGI)*/
209
- request.headers = _request.headers;
210
- /*** The underlying Node request */
211
- request.node = _request;
212
- request.nodeRequest = _request; // Deprecated
213
- /*** The underlying Node TCP connection */
214
- request.nodeConnection = _request.connection;
215
-
216
- return Q.when(request.body, function (body) {
217
- request.body = body;
218
- return request;
219
- });
220
- };
221
-
222
- exports.ServerResponse = function (_response, ssl) {
223
- var response = Object.create(_response);
224
- response.ssl = ssl;
225
- response.node = _response;
226
- response.nodeResponse = _response; // Deprecated
227
- return response;
228
- };
229
-
230
- exports.normalizeRequest = function (request) {
231
- if (typeof request === "string") {
232
- request = {
233
- url: request
234
- };
235
- }
236
- if (request.url) {
237
- var url = URL.parse(request.url);
238
- request.host = url.hostname;
239
- request.port = url.port;
240
- request.ssl = url.protocol === "https:";
241
- request.method = request.method || "GET";
242
- request.path = (url.pathname || "") + (url.search || "");
243
- request.headers = request.headers || {};
244
- request.headers.host = url.hostname; // FIXME name consistency
245
- }
246
- return request;
247
- };
248
-
249
- exports.normalizeResponse = function (response) {
250
- if (response === void 0) {
251
- return;
252
- }
253
- if (typeof response == "string") {
254
- response = [response];
255
- }
256
- if (response.forEach) {
257
- response = {
258
- status: 200,
259
- headers: {},
260
- body: response
261
- }
262
- }
263
- return response;
264
- };
265
-
266
- /**
267
- * Issues an HTTP request.
268
- *
269
- * @param {Request {host, port, method, path, headers,
270
- * body}} request (may be a promise)
271
- * @returns {Promise * Response} promise for a response
272
- */
273
- exports.request = function (request) {
274
- return Q.when(request, function (request) {
275
-
276
- request = exports.normalizeRequest(request);
277
-
278
- var deferred = Q.defer();
279
- var ssl = request.ssl;
280
- var http = ssl ? HTTPS : HTTP;
281
-
282
- var headers = request.headers || {};
283
-
284
- headers.host = headers.host || request.host;
285
-
286
- var _request = http.request({
287
- "host": request.host,
288
- "port": request.port || (ssl ? 443 : 80),
289
- "path": request.path || "/",
290
- "method": request.method || "GET",
291
- "headers": headers,
292
- "agent": request.agent
293
- }, function (_response) {
294
- deferred.resolve(exports.ClientResponse(_response, request.charset));
295
- _response.on("error", function (error) {
296
- // TODO find a better way to channel
297
- // this into the response
298
- console.warn(error && error.stack || error);
299
- deferred.reject(error);
300
- });
301
- });
302
-
303
- _request.on("error", function (error) {
304
- deferred.reject(error);
305
- });
306
-
307
- Q.when(request.body, function (body) {
308
- var end, done;
309
- if (body) {
310
- done = body.forEach(function (chunk) {
311
- end = Q.when(end, function () {
312
- return Q.when(chunk, function (chunk) {
313
- _request.write(chunk, request.charset);
314
- });
315
- });
316
- });
317
- }
318
- return Q.when(end, function () {
319
- return Q.when(done, function () {
320
- _request.end();
321
- });
322
- });
323
- }).done();
324
-
325
- return deferred.promise;
326
- });
327
- };
328
-
329
- /**
330
- * Issues a GET request to the given URL and returns
331
- * a promise for a `String` containing the entirety
332
- * of the response.
333
- *
334
- * @param {String} url
335
- * @returns {Promise * String} or a rejection if the
336
- * status code is not exactly 200. The reason for the
337
- * rejection is the full response object.
338
- */
339
- exports.read = function (request, qualifier) {
340
- qualifier = qualifier || function (response) {
341
- return response.status === 200;
342
- };
343
- return Q.when(exports.request(request), function (response) {
344
- if (!qualifier(response)){
345
- var error = new Error("HTTP request failed with code " + response.status);
346
- error.response = response;
347
- throw error;
348
- }
349
- return Q.post(response.body, 'read', []);
350
- });
351
- };
352
-
353
-
354
- /**
355
- * A wrapper for the Node HTTP Response as provided
356
- * by the Q HTTP Client API, suitable for use by the
357
- * Q HTTP Server API.
358
- */
359
- exports.ClientResponse = function (_response, charset) {
360
- var response = Object.create(exports.ClientResponse.prototype);
361
- /*** {Number} HTTP status code */
362
- response.status = _response.statusCode;
363
- /*** HTTP version */
364
- response.version = _response.httpVersion;
365
- /*** {Object} HTTP headers */
366
- response.headers = _response.headers;
367
- /***
368
- * A Q IO asynchronous text reader.
369
- */
370
- response.node = _response;
371
- response.nodeResponse = _response; // Deprecated
372
- response.nodeConnection = _response.connection; // Deprecated
373
- return Q.when(Reader(_response, charset), function (body) {
374
- response.body = body;
375
- return response;
376
- });
377
- };
378
-