traceur-rb 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (255) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +22 -0
  3. data/.rspec +1 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +4 -0
  7. data/Guardfile +8 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +87 -0
  10. data/Rakefile +2 -0
  11. data/lib/js/compile.js +31 -0
  12. data/lib/traceur-rb.rb +1 -0
  13. data/lib/traceur.rb +43 -0
  14. data/lib/traceur/compilation_options.rb +65 -0
  15. data/lib/traceur/compiler.rb +33 -0
  16. data/lib/traceur/configuration.rb +47 -0
  17. data/lib/traceur/node.rb +26 -0
  18. data/lib/traceur/node/command_result.rb +28 -0
  19. data/lib/traceur/node/runner.rb +40 -0
  20. data/lib/traceur/version.rb +3 -0
  21. data/spec/examples/classes.js +12 -0
  22. data/spec/integration/examples_spec.rb +28 -0
  23. data/spec/spec_helper.rb +1 -0
  24. data/spec/traceur/compilation_options_spec.rb +31 -0
  25. data/spec/traceur/configuration_spec.rb +54 -0
  26. data/spec/traceur/node_spec.rb +15 -0
  27. data/traceur-rb.gemspec +25 -0
  28. data/vendor/node_modules/.bin/traceur +3 -0
  29. data/vendor/node_modules/traceur/README.md +40 -0
  30. data/vendor/node_modules/traceur/bin/traceur-runtime.js +2101 -0
  31. data/vendor/node_modules/traceur/bin/traceur.js +23034 -0
  32. data/vendor/node_modules/traceur/node_modules/.bin/semver +125 -0
  33. data/vendor/node_modules/traceur/node_modules/commander/Readme.md +208 -0
  34. data/vendor/node_modules/traceur/node_modules/commander/index.js +852 -0
  35. data/vendor/node_modules/traceur/node_modules/commander/package.json +40 -0
  36. data/vendor/node_modules/traceur/node_modules/q-io/.npmignore +1 -0
  37. data/vendor/node_modules/traceur/node_modules/q-io/.travis.yml +3 -0
  38. data/vendor/node_modules/traceur/node_modules/q-io/CHANGES.md +122 -0
  39. data/vendor/node_modules/traceur/node_modules/q-io/LICENSE +19 -0
  40. data/vendor/node_modules/traceur/node_modules/q-io/README.md +928 -0
  41. data/vendor/node_modules/traceur/node_modules/q-io/buffer-stream.js +59 -0
  42. data/vendor/node_modules/traceur/node_modules/q-io/coverage-report.js +44 -0
  43. data/vendor/node_modules/traceur/node_modules/q-io/deprecate.js +51 -0
  44. data/vendor/node_modules/traceur/node_modules/q-io/fs-boot.js +307 -0
  45. data/vendor/node_modules/traceur/node_modules/q-io/fs-common.js +499 -0
  46. data/vendor/node_modules/traceur/node_modules/q-io/fs-mock.js +547 -0
  47. data/vendor/node_modules/traceur/node_modules/q-io/fs-root.js +105 -0
  48. data/vendor/node_modules/traceur/node_modules/q-io/fs.js +355 -0
  49. data/vendor/node_modules/traceur/node_modules/q-io/fs2http.js +65 -0
  50. data/vendor/node_modules/traceur/node_modules/q-io/http-apps.js +152 -0
  51. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/chain.js +24 -0
  52. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/content.js +93 -0
  53. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/cookie.js +154 -0
  54. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/decorators.js +178 -0
  55. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/fs.js +417 -0
  56. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/html.js +58 -0
  57. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/json.js +78 -0
  58. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/negotiate.js +120 -0
  59. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/proxy.js +27 -0
  60. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/redirect.js +209 -0
  61. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/route.js +125 -0
  62. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/status.js +175 -0
  63. data/vendor/node_modules/traceur/node_modules/q-io/http-cookie.js +75 -0
  64. data/vendor/node_modules/traceur/node_modules/q-io/http.js +378 -0
  65. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.npmignore +11 -0
  66. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.travis.yml +4 -0
  67. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/CHANGES.md +78 -0
  68. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/LICENSE.md +21 -0
  69. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/README.md +1285 -0
  70. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/collections.js +22 -0
  71. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/dict.js +142 -0
  72. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-map.js +57 -0
  73. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-set.js +183 -0
  74. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-collection.js +261 -0
  75. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-map.js +186 -0
  76. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-order.js +55 -0
  77. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-set.js +59 -0
  78. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/heap.js +236 -0
  79. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/iterator.js +371 -0
  80. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/list.js +435 -0
  81. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/array-changes.js +247 -0
  82. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/map-changes.js +147 -0
  83. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/property-changes.js +448 -0
  84. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/range-changes.js +139 -0
  85. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-map.js +79 -0
  86. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-set.js +142 -0
  87. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/map.js +60 -0
  88. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/multi-map.js +41 -0
  89. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/package.json +12 -0
  90. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync +7 -0
  91. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync.patch +48 -0
  92. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/weak-map.js +590 -0
  93. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/package.json +49 -0
  94. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/set.js +173 -0
  95. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-array.js +274 -0
  96. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-function.js +59 -0
  97. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-object.js +538 -0
  98. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-regexp.js +14 -0
  99. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim.js +6 -0
  100. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-map.js +49 -0
  101. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-set.js +51 -0
  102. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array.js +269 -0
  103. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-map.js +61 -0
  104. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-set.js +736 -0
  105. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/tree-log.js +40 -0
  106. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/weak-map.js +1 -0
  107. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/LICENSE +19 -0
  108. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/README.md +66 -0
  109. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/mime.js +114 -0
  110. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/package.json +35 -0
  111. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/test.js +84 -0
  112. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/mime.types +1588 -0
  113. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/node.types +77 -0
  114. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/CHANGES +15 -0
  115. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/LICENSE +19 -0
  116. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/README +96 -0
  117. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/lib/mimeparse.js +166 -0
  118. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/package.json +43 -0
  119. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/CONTRIBUTING.md +40 -0
  120. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/LICENSE +19 -0
  121. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/README.md +813 -0
  122. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/compare-with-callbacks.js +71 -0
  123. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/scenarios.js +36 -0
  124. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/package.json +93 -0
  125. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/q.js +1937 -0
  126. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/queue.js +35 -0
  127. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/.gitmodules +6 -0
  128. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/History.md +36 -0
  129. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Makefile +7 -0
  130. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Readme.md +38 -0
  131. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/benchmark.js +32 -0
  132. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/examples.js +39 -0
  133. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/index.js +2 -0
  134. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/lib/querystring.js +123 -0
  135. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/package.json +19 -0
  136. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.gitmodules +3 -0
  137. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.npmignore +3 -0
  138. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/History.md +128 -0
  139. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Makefile +53 -0
  140. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Readme.md +61 -0
  141. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/bin/expresso +856 -0
  142. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/api.html +1080 -0
  143. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.html +377 -0
  144. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.md +290 -0
  145. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/foot.html +3 -0
  146. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/head.html +42 -0
  147. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/bar.js +4 -0
  148. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/foo.js +16 -0
  149. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/package.json +12 -0
  150. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/assert.test.js +91 -0
  151. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/async.test.js +12 -0
  152. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/bar.test.js +13 -0
  153. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/foo.test.js +14 -0
  154. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/http.test.js +146 -0
  155. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/async.test.js +39 -0
  156. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/http.test.js +48 -0
  157. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/.gitmodules +3 -0
  158. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/History.md +22 -0
  159. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Makefile +6 -0
  160. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Readme.md +248 -0
  161. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/examples/runner.js +53 -0
  162. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/index.js +2 -0
  163. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/eql.js +91 -0
  164. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/should.js +548 -0
  165. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/package.json +8 -0
  166. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/test/should.test.js +358 -0
  167. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/test/querystring.test.js +133 -0
  168. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.npmignore +3 -0
  169. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.travis.yml +4 -0
  170. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/LICENSE.md +20 -0
  171. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/README.md +33 -0
  172. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/package.json +37 -0
  173. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/test/url2-spec.js +125 -0
  174. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/url2.js +151 -0
  175. data/vendor/node_modules/traceur/node_modules/q-io/package.json +51 -0
  176. data/vendor/node_modules/traceur/node_modules/q-io/reader.js +133 -0
  177. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/boot-directory-spec.js +47 -0
  178. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/contains-spec.js +11 -0
  179. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/fixtures/hello.txt +1 -0
  180. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/issues/1-spec.js +33 -0
  181. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/make-tree-spec.js +92 -0
  182. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/append-spec.js +41 -0
  183. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/copy-tree-spec.js +57 -0
  184. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/fixture/hello.txt +1 -0
  185. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/link-spec.js +70 -0
  186. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/make-tree-spec.js +109 -0
  187. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/merge-spec.js +67 -0
  188. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/move-spec.js +219 -0
  189. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/object-spec.js +20 -0
  190. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/range-spec.js +26 -0
  191. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/read-spec.js +40 -0
  192. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-directory-spec.js +37 -0
  193. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-tree-spec.js +39 -0
  194. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/root-spec.js +32 -0
  195. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/stat-spec.js +26 -0
  196. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/symbolic-link-spec.js +86 -0
  197. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/working-directory-spec.js +31 -0
  198. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/write-spec.js +73 -0
  199. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.js +23 -0
  200. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.txt +1 -0
  201. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/read-spec.js +22 -0
  202. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/relative-spec.js +25 -0
  203. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/reroot-spec.js +45 -0
  204. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/write-spec.js +38 -0
  205. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/cookie-spec.js +52 -0
  206. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/directory-list-spec.js +86 -0
  207. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/01234.txt +1 -0
  208. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/1234.txt +1 -0
  209. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/5678.txt +0 -0
  210. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/9012/3456.txt +0 -0
  211. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/hosts-spec.js +49 -0
  212. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/interpret-range-spec.js +47 -0
  213. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/partial-range-spec.js +186 -0
  214. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/proxy-spec.js +82 -0
  215. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/symbolic-link-spec.js +110 -0
  216. data/vendor/node_modules/traceur/node_modules/q-io/spec/http/agent-spec.js +96 -0
  217. data/vendor/node_modules/traceur/node_modules/q-io/spec/http/basic-spec.js +96 -0
  218. data/vendor/node_modules/traceur/node_modules/q-io/spec/lib/jasmine-promise.js +42 -0
  219. data/vendor/node_modules/traceur/node_modules/q-io/writer.js +111 -0
  220. data/vendor/node_modules/traceur/node_modules/semver/.npmignore +1 -0
  221. data/vendor/node_modules/traceur/node_modules/semver/LICENSE +27 -0
  222. data/vendor/node_modules/traceur/node_modules/semver/Makefile +24 -0
  223. data/vendor/node_modules/traceur/node_modules/semver/README.md +158 -0
  224. data/vendor/node_modules/traceur/node_modules/semver/bin/semver +125 -0
  225. data/vendor/node_modules/traceur/node_modules/semver/foot.js +6 -0
  226. data/vendor/node_modules/traceur/node_modules/semver/head.js +2 -0
  227. data/vendor/node_modules/traceur/node_modules/semver/package.json +31 -0
  228. data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js +1039 -0
  229. data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js.gz +0 -0
  230. data/vendor/node_modules/traceur/node_modules/semver/semver.js +1043 -0
  231. data/vendor/node_modules/traceur/node_modules/semver/semver.min.js +1 -0
  232. data/vendor/node_modules/traceur/node_modules/semver/semver.min.js.gz +0 -0
  233. data/vendor/node_modules/traceur/node_modules/semver/test/amd.js +15 -0
  234. data/vendor/node_modules/traceur/node_modules/semver/test/gtr.js +173 -0
  235. data/vendor/node_modules/traceur/node_modules/semver/test/index.js +584 -0
  236. data/vendor/node_modules/traceur/node_modules/semver/test/ltr.js +174 -0
  237. data/vendor/node_modules/traceur/node_modules/semver/test/no-module.js +19 -0
  238. data/vendor/node_modules/traceur/package.json +64 -0
  239. data/vendor/node_modules/traceur/src/node/System.js +31 -0
  240. data/vendor/node_modules/traceur/src/node/api.js +124 -0
  241. data/vendor/node_modules/traceur/src/node/command.js +141 -0
  242. data/vendor/node_modules/traceur/src/node/compile-single-file.js +69 -0
  243. data/vendor/node_modules/traceur/src/node/compiler.js +116 -0
  244. data/vendor/node_modules/traceur/src/node/deferred.js +110 -0
  245. data/vendor/node_modules/traceur/src/node/file-util.js +73 -0
  246. data/vendor/node_modules/traceur/src/node/getopt.js +147 -0
  247. data/vendor/node_modules/traceur/src/node/inline-module.js +149 -0
  248. data/vendor/node_modules/traceur/src/node/interpreter.js +33 -0
  249. data/vendor/node_modules/traceur/src/node/nodeLoader.js +41 -0
  250. data/vendor/node_modules/traceur/src/node/require.js +85 -0
  251. data/vendor/node_modules/traceur/src/node/to-amd-compiler.js +33 -0
  252. data/vendor/node_modules/traceur/src/node/to-commonjs-compiler.js +33 -0
  253. data/vendor/node_modules/traceur/src/node/traceur.js +32 -0
  254. data/vendor/node_modules/traceur/traceur +3 -0
  255. metadata +359 -0
@@ -0,0 +1,65 @@
1
+
2
+ var Q = require("q");
3
+ var HTTP = require("./http");
4
+ var URL = require("url");
5
+
6
+ exports.Client = Client;
7
+ function Client(fs) {
8
+ var self = Object.create(Client.prototype);
9
+
10
+ self.request = function (request) {
11
+ return Q.when(request, function (request) {
12
+ request = HTTP.normalizeRequest(request);
13
+ var url = URL.parse(request.url);
14
+ if (url.protocol !== "file:") {
15
+ return {
16
+ status: 404,
17
+ headers: {},
18
+ body: ["Can't access protocol " + url.protocol]
19
+ };
20
+ } else {
21
+ var path = url.pathname;
22
+ return fs.open(path, {
23
+ charset: request.charset
24
+ }).then(function (body) {
25
+ return {
26
+ status: 200,
27
+ headers: {},
28
+ body: body
29
+ };
30
+ });
31
+ }
32
+ });
33
+ };
34
+
35
+ self.read = function (request, qualifier) {
36
+ qualifier = qualifier || function (response) {
37
+ return response.status === 200;
38
+ };
39
+ return Q.when(exports.request(request), function (response) {
40
+ if (!qualifier(response)){
41
+ var error = new Error("HTTP request failed with code " + response.status);
42
+ error.response = response;
43
+ throw error;
44
+ }
45
+ return Q.invoke(response.body, "read");
46
+ });
47
+ };
48
+
49
+ return self;
50
+ }
51
+
52
+ exports.request = function (request) {
53
+ return Q.fcall(require.async || require, "./fs")
54
+ .then(function (fs) {
55
+ return Client(fs).request(request);
56
+ });
57
+ };
58
+
59
+ exports.read = function (request, qualifier) {
60
+ return Q.fcall(require.async || require, "./fs")
61
+ .then(function (fs) {
62
+ return Client(fs).read(request);
63
+ });
64
+ };
65
+
@@ -0,0 +1,152 @@
1
+
2
+ /**
3
+ * Provides tools for making, routing, adapting, and decorating
4
+ * Q-JSGI web applications.
5
+ *
6
+ * Duck Types
7
+ * ----------
8
+ *
9
+ * A Q-JSGI _app_ is a function that accepts a request and returns a
10
+ * response. The response may be promised.
11
+ *
12
+ * A Q-JSGI _request_ is an object or a promise for an object that has
13
+ * the following properties:
14
+ *
15
+ * * `method` is the HTTP request method as a string.
16
+ * * `path` is a string, guaranteed to start with `"/"`.
17
+ * * `headers` is an object mapping lower-case HTTP headers to
18
+ * their corresponding values as strings.
19
+ * * `body` is a Q-JSGI content body.
20
+ *
21
+ * A Q-JSGI _response_ is an object or a promise for an object that
22
+ * has the following properties:
23
+ *
24
+ * * `status` is the HTTP response status code as a number.
25
+ * * `headers` is an object mapping lower-case HTTP headers to their
26
+ * corresponding values as strings.
27
+ * * `body` is a Q-JSGI content body.
28
+ *
29
+ * A Q-JSGI response and request content _body_ can be as simple as an
30
+ * array of strings. It can be a promise. In general, it must be an
31
+ * object that has a `forEach` method. The `forEach` method accepts a
32
+ * `write` function. It goes without saying that `forEach` returns
33
+ * `undefined`, but it can return a promise for `undefined` that will
34
+ * resolve when it has made all of its `write` calls and the request
35
+ * or response can be closed, re-used, or kept alive.. The `forEach`
36
+ * function may call `write` with a `String` any number of times. The
37
+ * `String` may be promised.
38
+ *
39
+ * @module
40
+ */
41
+
42
+ require("collections/shim");
43
+ var Q = require("q");
44
+ var HTTP = require("./http");
45
+ var FS = require("./fs");
46
+ var URL = require("url2");
47
+ var inspect = require("util").inspect;
48
+
49
+ exports.Chain = require("./http-apps/chain");
50
+
51
+ var RouteApps = require("./http-apps/route");
52
+ exports.Cap = RouteApps.Cap;
53
+ exports.Tap = RouteApps.Tap;
54
+ exports.Trap = RouteApps.Trap;
55
+ exports.Branch = RouteApps.Branch;
56
+
57
+ var ContentApps = require("./http-apps/content");
58
+ exports.Content = ContentApps.Content;
59
+ exports.content = ContentApps.content;
60
+ exports.ok = ContentApps.ok;
61
+ exports.ContentRequest = ContentApps.ContentRequest;
62
+ exports.Inspect = ContentApps.Inspect;
63
+ exports.ParseQuery = ContentApps.ParseQuery;
64
+
65
+ var FsApps = require("./http-apps/fs");
66
+ exports.File = FsApps.File;
67
+ exports.FileTree = FsApps.FileTree;
68
+ exports.file = FsApps.file;
69
+ exports.directory = FsApps.directory;
70
+ exports.etag = FsApps.etag;
71
+
72
+ exports.ListDirectories = FsApps.ListDirectories;
73
+ exports.listDirectory = FsApps.listDirectory;
74
+ exports.listDirectoryHtmlFragment = FsApps.listDirectoryHtmlFragment;
75
+ exports.listDirectoryText = FsApps.listDirectoryText;
76
+ exports.listDirectoryMarkdown = FsApps.listDirectoryMarkdown;
77
+ exports.listDirectoryJson = FsApps.listDirectoryJson;
78
+ exports.listDirectoryData = FsApps.listDirectoryData;
79
+ exports.DirectoryIndex = FsApps.DirectoryIndex;
80
+
81
+ var HtmlApps = require("./http-apps/html");
82
+ exports.HandleHtmlFragmentResponses = HtmlApps.HandleHtmlFragmentResponses;
83
+ exports.handleHtmlFragmentResponse = HtmlApps.handleHtmlFragmentResponse;
84
+ exports.escapeHtml = HtmlApps.escapeHtml;
85
+
86
+ var JsonApps = require("./http-apps/json");
87
+ exports.HandleJsonResponses = JsonApps.HandleJsonResponses;
88
+ exports.handleJsonResponse = JsonApps.handleJsonResponse;
89
+ exports.Json = JsonApps.Json;
90
+ exports.json = JsonApps.json;
91
+ exports.JsonRequest = JsonApps.JsonRequest;
92
+
93
+ var RedirectApps = require("./http-apps/redirect");
94
+ exports.PermanentRedirect = RedirectApps.PermanentRedirect;
95
+ exports.PermanentRedirectTree = RedirectApps.PermanentRedirectTree;
96
+ exports.TemporaryRedirect = RedirectApps.TemporaryRedirect;
97
+ exports.TemporaryRedirectTree = RedirectApps.TemporaryRedirectTree;
98
+ exports.Redirect = RedirectApps.Redirect;
99
+ exports.RedirectTree = RedirectApps.RedirectTree;
100
+ exports.permanentRedirect = RedirectApps.permanentRedirect;
101
+ exports.permanentRedirectTree = RedirectApps.permanentRedirectTree;
102
+ exports.temporaryRedirect = RedirectApps.temporaryRedirect;
103
+ exports.temporaryRedirectTree = RedirectApps.temporaryRedirectTree;
104
+ exports.redirectTree = RedirectApps.redirectTree;
105
+ exports.redirect = RedirectApps.redirect;
106
+ exports.redirectText = RedirectApps.redirectText;
107
+ exports.redirectHtml = RedirectApps.redirectHtml;
108
+ exports.RedirectTrap = RedirectApps.RedirectTrap;
109
+ exports.isRedirect = RedirectApps.isRedirect;
110
+
111
+ var ProxyApps = require("./http-apps/proxy");
112
+ exports.Proxy = ProxyApps.Proxy;
113
+ exports.ProxyTree = ProxyApps.ProxyTree;
114
+
115
+ var NegotiationApps = require("./http-apps/negotiate");
116
+ exports.negotiate = NegotiationApps.negotiate;
117
+ exports.Method = NegotiationApps.Method;
118
+ exports.ContentType = NegotiationApps.ContentType;
119
+ exports.Language = NegotiationApps.Language;
120
+ exports.Charset = NegotiationApps.Charset;
121
+ exports.Encoding = NegotiationApps.Encoding;
122
+ exports.Host = NegotiationApps.Host;
123
+ exports.Select = NegotiationApps.Select;
124
+
125
+ var StatusApps = require("./http-apps/status");
126
+ exports.statusCodes = StatusApps.statusCodes;
127
+ exports.statusMessages = StatusApps.statusMessages;
128
+ exports.statusWithNoEntityBody = StatusApps.statusWithNoEntityBody;
129
+ exports.appForStatus = StatusApps.appForStatus;
130
+ exports.responseForStatus = StatusApps.responseForStatus;
131
+ exports.textResponseForStatus = StatusApps.textResponseForStatus;
132
+ exports.htmlResponseForStatus = StatusApps.htmlResponseForStatus;
133
+ exports.badRequest = StatusApps.badRequest;
134
+ exports.notFound = StatusApps.notFound;
135
+ exports.methodNotAllowed = StatusApps.methodNotAllowed;
136
+ exports.noLanguage = StatusApps.noLanguage;
137
+ exports.notAcceptable = StatusApps.notAcceptable;
138
+
139
+ var DecoratorApps = require("./http-apps/decorators");
140
+ exports.Normalize = DecoratorApps.Normalize;
141
+ exports.Date = DecoratorApps.Date;
142
+ exports.Error = DecoratorApps.Error;
143
+ exports.Debug = DecoratorApps.Debug;
144
+ exports.Log = DecoratorApps.Log;
145
+ exports.Time = DecoratorApps.Time;
146
+ exports.Headers = DecoratorApps.Headers;
147
+ exports.Permanent = DecoratorApps.Permanent;
148
+ exports.Decorators = DecoratorApps.Decorators;
149
+
150
+ var CookieApps = require("./http-apps/cookie");
151
+ exports.CookieJar = CookieApps.CookieJar;
152
+
@@ -0,0 +1,24 @@
1
+
2
+ module.exports = Chain;
3
+ function Chain(end) {
4
+ var self = Object.create(Chain.prototype);
5
+ self.end = end || function (next) {
6
+ return next;
7
+ };
8
+ return self;
9
+ };
10
+
11
+ Chain.prototype.use = function (App /*, ...args*/) {
12
+ if (!App) throw new Error("App is not defined after " + this.app);
13
+ var args = Array.prototype.slice.call(arguments, 1);
14
+ var self = this;
15
+ this.end = (function (End) {
16
+ return function Self(next) {
17
+ if (self.end !== Self && !next) throw new Error("App chain is broken after " + App);
18
+ return End(App.apply(null, [next].concat(args)));
19
+ };
20
+ })(this.end);
21
+ this.app = App;
22
+ return this;
23
+ };
24
+
@@ -0,0 +1,93 @@
1
+ var Q = require("q");
2
+ var Negotiate = require("./negotiate");
3
+ var QS = require("qs");
4
+ var URL = require("url2");
5
+
6
+ /**
7
+ * Makes an app that returns a response with static content
8
+ * from memory.
9
+ * @param {Body} body a Q-JSGI
10
+ * response body
11
+ * @param {String} contentType
12
+ * @param {Number} status
13
+ * @returns {App} a Q-JSGI app
14
+ */
15
+ exports.Content = function (body, contentType, status) {
16
+ return function (request, response) {
17
+ return {
18
+ "status": status || 200,
19
+ "headers": {
20
+ "content-type": contentType || "text/plain"
21
+ },
22
+ "body": body || ""
23
+ };
24
+ };
25
+ };
26
+
27
+ /**
28
+ * Returns a Q-JSGI response with the given content.
29
+ * @param {Body} content (optional) defaults to `[""]`
30
+ * @param {String} contentType (optional) defaults to `"text/plain"`
31
+ * @param {Number} status (optional) defaults to `200`
32
+ * @returns {Response}
33
+ */
34
+ exports.content =
35
+ exports.ok = function (content, contentType, status) {
36
+ status = status || 200;
37
+ content = content || "";
38
+ if (typeof content === "string") {
39
+ content = [content];
40
+ }
41
+ contentType = contentType || "text/plain";
42
+ return {
43
+ "status": status,
44
+ "headers": {
45
+ "content-type": contentType
46
+ },
47
+ "body": content
48
+ };
49
+ };
50
+
51
+ /**
52
+ * Wraps an app such that it expects to receive content
53
+ * in the request body and passes that content as a string
54
+ * to as the second argument to the wrapped JSGI app.
55
+ *
56
+ * @param {Function(Request, Object):Response} app
57
+ * @returns {App}
58
+ */
59
+ exports.ContentRequest = function (app) {
60
+ return function (request, response) {
61
+ return Q.when(request.body.read(), function (body) {
62
+ return app(body, request, response);
63
+ });
64
+ };
65
+ };
66
+
67
+ /**
68
+ * @param {Function(Request):Object}
69
+ * @returns {App}
70
+ */
71
+ exports.Inspect = function (app) {
72
+ return Negotiate.Method({"GET": function (request, response) {
73
+ return Q.when(app(request, response), function (object) {
74
+ return {
75
+ status: 200,
76
+ headers: {
77
+ "content-type": "text/plain"
78
+ },
79
+ body: [inspect(object)]
80
+ }
81
+ });
82
+ }});
83
+ };
84
+
85
+ /**
86
+ */
87
+ exports.ParseQuery = function (app) {
88
+ return function (request, response) {
89
+ request.query = QS.parse(URL.parse(request.url).query || "");
90
+ return app(request, response);
91
+ };
92
+ };
93
+
@@ -0,0 +1,154 @@
1
+
2
+ var Q = require("q");
3
+ var Cookie = require("../http-cookie");
4
+
5
+ exports.CookieJar = function (app) {
6
+ var hostCookies = {}; // to {} of pathCookies to [] of cookies
7
+ return function (request) {
8
+
9
+ var hosts = allHostsContaining(request.headers.host);
10
+
11
+ var now = new Date();
12
+
13
+ var requestCookies = concat(hosts.map(function (host) {
14
+
15
+ // delete expired cookies
16
+ for (var host in hostCookies) {
17
+ var pathCookies = hostCookies[host];
18
+ for (var path in pathCookies) {
19
+ var cookies = pathCookies[path];
20
+ for (var name in cookies) {
21
+ var cookie = cookies[name];
22
+ if (cookie.expires && cookie.expires > now) {
23
+ delete cookie[name];
24
+ }
25
+ }
26
+ }
27
+ }
28
+
29
+ // collect applicable cookies
30
+ return concat(
31
+ Object.keys(hostCookies)
32
+ .map(function (host) {
33
+ if (!hostContains(host, request.headers.host))
34
+ return [];
35
+ var pathCookies = hostCookies[host];
36
+ return concat(
37
+ Object.keys(pathCookies)
38
+ .map(function (path) {
39
+ if (!pathContains(path, request.path))
40
+ return [];
41
+ var cookies = pathCookies[path];
42
+ return (
43
+ Object.keys(cookies)
44
+ .map(function (name) {
45
+ return cookies[name];
46
+ })
47
+ .filter(function (cookie) {
48
+ return cookie.secure ?
49
+ request.ssl :
50
+ true;
51
+ })
52
+ );
53
+ })
54
+ )
55
+ })
56
+ );
57
+
58
+ }));
59
+
60
+ if (requestCookies.length) {
61
+ request.headers["cookie"] = (
62
+ requestCookies
63
+ .map(function (cookie) {
64
+ return Cookie.stringify(
65
+ cookie.key,
66
+ cookie.value,
67
+ cookie
68
+ );
69
+ })
70
+ .join("; ")
71
+ );
72
+ }
73
+
74
+ return Q.when(app.apply(this, arguments), function (response) {
75
+ response.headers = response.headers || {};
76
+ if (response.headers["set-cookie"]) {
77
+ var requestHost = ipRe.test(request.headers.host) ?
78
+ request.headers.host :
79
+ "." + request.headers.host;
80
+ // normalize to array
81
+ if (!Array.isArray(response.headers["set-cookie"])) {
82
+ response.headers["set-cookie"] = [response.headers["set-cookie"]];
83
+ }
84
+ response.headers["set-cookie"].forEach(function (cookie) {
85
+ var date = response.headers["date"] ?
86
+ new Date(response.headers["date"]) :
87
+ new Date();
88
+ cookie = Cookie.parse(cookie, date);
89
+ // ignore illegal host
90
+ if (cookie.host && !hostContains(requestHost, cookie.host))
91
+ delete cookie.host;
92
+ var host = requestHost || cookie.host;
93
+ var path = cookie.path || "/";
94
+ var pathCookies = hostCookies[host] = hostCookies[host] || {};
95
+ var cookies = pathCookies[path] = pathCookies[path] || {};
96
+ cookies[cookie.key] = cookie;
97
+ })
98
+ delete response.headers["set-cookie"];
99
+ }
100
+
101
+ return response;
102
+ });
103
+
104
+ };
105
+ };
106
+
107
+ var ipRe = /^\d+\.\d+\.\d+\.\d+$/;
108
+
109
+ function allHostsContaining(content) {
110
+ if (ipRe.test(content)) {
111
+ return [content];
112
+ } if (content === "localhost") {
113
+ return [content];
114
+ } else {
115
+ var parts = content.split(".");
116
+ var hosts = [];
117
+ while (parts.length > 1) {
118
+ hosts.push("." + parts.join("."));
119
+ parts.shift();
120
+ }
121
+ return hosts;
122
+ }
123
+ }
124
+
125
+ function hostContains(container, content) {
126
+ if (ipRe.test(container) || ipRe.test(content)) {
127
+ return container === content;
128
+ } else if (/^\./.test(container)) {
129
+ return (
130
+ content.lastIndexOf(container) ===
131
+ content.length - container.length
132
+ ) || (
133
+ container.slice(1) === content
134
+ );
135
+ } else {
136
+ return container === content;
137
+ }
138
+ };
139
+
140
+ function pathContains(container, content) {
141
+ if (/^\/$/.test(container)) {
142
+ return content.indexOf(container) === 0;
143
+ } else {
144
+ return (
145
+ content === container ||
146
+ content.indexOf(container + "/") === 0
147
+ );
148
+ }
149
+ }
150
+
151
+ function concat(arrays) {
152
+ return [].concat.apply([], arrays);
153
+ }
154
+