traceur-rb 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,69 @@
1
+ // Copyright 2013 Traceur Authors.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ 'use strict';
16
+
17
+ var fs = require('q-io/fs');
18
+ var path = require('path');
19
+ var writeTreeToFile = require('./compiler.js').writeTreeToFile;
20
+
21
+ var traceur = require('./traceur.js');
22
+ var ErrorReporter = traceur.util.ErrorReporter;
23
+ var AttachModuleNameTransformer =
24
+ traceur.codegeneration.module.AttachModuleNameTransformer;
25
+ var FromOptionsTransformer = traceur.codegeneration.FromOptionsTransformer;
26
+ var Parser = traceur.syntax.Parser;
27
+ var SourceFile = traceur.syntax.SourceFile;
28
+
29
+ function compileSingleFile(inputFilePath, outputFilePath, anonymousModules) {
30
+ return fs.read(inputFilePath).then(function(contents) {
31
+ var reporter = new ErrorReporter();
32
+ var sourceFile = new SourceFile(inputFilePath, contents);
33
+ var parser = new Parser(sourceFile, reporter);
34
+ var tree = parser.parseModule();
35
+ var moduleName, transformer;
36
+ if (!anonymousModules) {
37
+ moduleName = inputFilePath.replace(/\.js$/, '').replace(/\\/g,'/');
38
+ // Module naming uses ./ to signal relative names.
39
+ if (moduleName[0] !== '/')
40
+ moduleName = './' + moduleName;
41
+ transformer = new AttachModuleNameTransformer(moduleName);
42
+ tree = transformer.transformAny(tree);
43
+ }
44
+ transformer = new FromOptionsTransformer(reporter);
45
+ var transformed = transformer.transform(tree);
46
+
47
+ if (!reporter.hadError()) {
48
+ writeTreeToFile(transformed, outputFilePath);
49
+ }
50
+ });
51
+ }
52
+
53
+ function onlyJsFiles(path, stat) {
54
+ return stat.isFile() && /\.js$/.test(path) || false;
55
+ }
56
+
57
+ function compileAllJsFilesInDir(inputDir, outputDir, anonymousModules) {
58
+ inputDir = path.normalize(inputDir);
59
+ outputDir = path.normalize(outputDir);
60
+ fs.listTree(inputDir, onlyJsFiles).then(function(files) {
61
+ files.forEach(function(inputFilePath) {
62
+ var outputFilePath = inputFilePath.replace(inputDir, outputDir);
63
+ compileSingleFile(inputFilePath, outputFilePath, anonymousModules).done();
64
+ });
65
+ }).done();
66
+ }
67
+
68
+ compileSingleFile.compileAllJsFilesInDir = compileAllJsFilesInDir;
69
+ module.exports = compileSingleFile;
@@ -0,0 +1,116 @@
1
+ // Copyright 2013 Traceur Authors.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ 'use strict';
16
+
17
+ var fs = require('fs');
18
+ var path = require('path');
19
+
20
+ var traceur = require('./traceur.js');
21
+
22
+ var inlineAndCompile = require('./inline-module.js').inlineAndCompile;
23
+ var util = require('./file-util.js');
24
+ var writeFile = util.writeFile;
25
+ var mkdirRecursive = util.mkdirRecursive;
26
+ var normalizePath = util.normalizePath;
27
+
28
+ var ErrorReporter = traceur.util.ErrorReporter;
29
+ var TreeWriter = traceur.outputgeneration.TreeWriter;
30
+ var SourceMapGenerator = traceur.outputgeneration.SourceMapGenerator;
31
+
32
+ function getSourceMapFileName(name) {
33
+ return name.replace(/\.js$/, '.map');
34
+ }
35
+
36
+ function writeTreeToFile(tree, filename, useSourceMaps, opt_sourceRoot) {
37
+ var options;
38
+ if (useSourceMaps) {
39
+ var sourceMapFilePath = getSourceMapFileName(filename);
40
+ var config = {
41
+ file: path.basename(filename),
42
+ sourceRoot: opt_sourceRoot
43
+ };
44
+ var sourceMapGenerator = new SourceMapGenerator(config);
45
+ options = {sourceMapGenerator: sourceMapGenerator};
46
+ }
47
+
48
+ var compiledCode = TreeWriter.write(tree, options);
49
+ if (useSourceMaps) {
50
+ compiledCode += '\n//# sourceMappingURL=' +
51
+ path.basename(sourceMapFilePath) + '\n';
52
+ }
53
+ writeFile(filename, compiledCode);
54
+ if (useSourceMaps)
55
+ writeFile(sourceMapFilePath, options.sourceMap);
56
+ }
57
+
58
+ function compileToSingleFile(outputFile, includes, useSourceMaps) {
59
+ var reporter = new ErrorReporter();
60
+ var resolvedOutputFile = path.resolve(outputFile);
61
+ var outputDir = path.dirname(resolvedOutputFile);
62
+
63
+ // Resolve includes before changing directory.
64
+ var resolvedIncludes = includes.map(function(include) {
65
+ include.name = path.resolve(include.name);
66
+ return include;
67
+ });
68
+
69
+ mkdirRecursive(outputDir);
70
+ process.chdir(outputDir);
71
+
72
+ // Make includes relative to output dir so that sourcemap paths are correct.
73
+ resolvedIncludes = resolvedIncludes.map(function(include) {
74
+ include.name = normalizePath(path.relative(outputDir, include.name));
75
+ return include;
76
+ });
77
+
78
+ inlineAndCompile(resolvedIncludes, traceur.options, reporter, function(tree) {
79
+ writeTreeToFile(tree, resolvedOutputFile, useSourceMaps);
80
+ process.exit(0);
81
+ }, function(err) {
82
+ console.error(err);
83
+ process.exit(1);
84
+ });
85
+ }
86
+
87
+ function compileToDirectory(outputDir, includes, useSourceMaps) {
88
+ var reporter = new ErrorReporter();
89
+ var outputDir = path.resolve(outputDir);
90
+
91
+ var current = 0;
92
+
93
+ function next() {
94
+ if (current === includes.length)
95
+ process.exit(0);
96
+
97
+ inlineAndCompile(includes.slice(current, current + 1), traceur.options,
98
+ reporter,
99
+ function(tree) {
100
+ var outputFile = path.join(outputDir, includes[current].name);
101
+ var sourceRoot = path.relative(path.dirname(outputFile), '.');
102
+ writeTreeToFile(tree, outputFile, useSourceMaps, sourceRoot);
103
+ current++;
104
+ next();
105
+ },
106
+ function(err) {
107
+ process.exit(1);
108
+ });
109
+ }
110
+
111
+ next();
112
+ }
113
+
114
+ exports.compileToSingleFile = compileToSingleFile;
115
+ exports.compileToDirectory = compileToDirectory;
116
+ exports.writeTreeToFile = writeTreeToFile;
@@ -0,0 +1,110 @@
1
+ // Copyright 2013 Traceur Authors.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ 'use strict';
16
+
17
+ /**
18
+ * Wrap a single async function to make the callback optional and hook it to
19
+ * trigger reject/resolve of the Promise, which it returns (this ignores the
20
+ * async function's return value). This enables the use of await with the
21
+ * wrapped function.
22
+ *
23
+ * @param {Function} fn Function to wrap.
24
+ * @param {boolean} firstArg True if the async callback is the first argument.
25
+ * @return {Function}
26
+ */
27
+ function wrapFunction(fn, firstArg) {
28
+ return function() {
29
+ var resolve, reject;
30
+ var promise = new Promise(function(res, rej) {
31
+ resolve = res;
32
+ reject = rej;
33
+ });
34
+
35
+ var args = [].slice.call(arguments);
36
+ var originalCallback = args[firstArg ? 0 : args.length - 1];
37
+
38
+ function callback(err, value) {
39
+ if (originalCallback)
40
+ originalCallback.apply(this, arguments);
41
+
42
+ if (err)
43
+ reject(err);
44
+ else
45
+ resolve(value);
46
+ }
47
+
48
+ if (typeof originalCallback !== 'function') {
49
+ // Callback wasn't provided to the async function, add the custom one.
50
+ originalCallback = null;
51
+ if (firstArg)
52
+ args.unshift(callback);
53
+ else
54
+ args.push(callback);
55
+ } else {
56
+ // Callback was provided to the async function, replace it.
57
+ args[firstArg ? 0 : args.length - 1] = callback;
58
+ }
59
+
60
+ fn.apply(this, args);
61
+
62
+ return promise;
63
+ };
64
+ }
65
+
66
+ /**
67
+ * Wrap async functions in a module to enable the use of await.
68
+ * If no function name array is provided, every function with a fnSync
69
+ * variant will be wrapped.
70
+ *
71
+ * @param {string|Object} module The exports of the module or a string that
72
+ * will be passed to require to get the module.
73
+ * @param {Array.<string>} functions Function names to wrap.
74
+ * @return {object} The module.
75
+ */
76
+ function wrapModule(module, functions) {
77
+ if (typeof module === 'string')
78
+ module = require(module);
79
+
80
+ if (!functions) {
81
+ for (var k in module) {
82
+ // HACK: wrap all functions with a fnSync variant.
83
+ if (typeof module[k] === 'function' &&
84
+ typeof module[k + 'Sync'] === 'function')
85
+ module[k] = wrapFunction(module[k]);
86
+ }
87
+ } else {
88
+ for (var i = 0, k; i < functions.length; i++) {
89
+ var k = functions[i];
90
+ module[k] = wrapFunction(module[k]);
91
+ }
92
+ }
93
+
94
+ return module;
95
+ }
96
+
97
+ /**
98
+ * Wrap async functions in Node.js to enable the use of await.
99
+ *
100
+ * @return {void}
101
+ */
102
+ function wrap() {
103
+ // TODO: find and wrap everything that needs to be wrapped.
104
+ wrapModule('fs');
105
+ process.nextTick = wrapFunction(process.nextTick, true);
106
+ // FIXME: this would ignore the return value, making it impossible to cancel
107
+ // the timeout without implementing a cancel method and using it everywhere.
108
+ //global.setTimeout = wrapFunction(setTimeout, true);
109
+ }
110
+ exports.wrap = wrap;
@@ -0,0 +1,73 @@
1
+ // Copyright 2013 Traceur Authors.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ var fs = require('fs');
16
+ var path = require('path');
17
+
18
+ function existsSync(p) {
19
+ return fs.existsSync ? fs.existsSync(p) : path.existsSync(p);
20
+ }
21
+
22
+ /**
23
+ * Recursively makes all directoires, similar to mkdir -p
24
+ * @param {string} dir
25
+ */
26
+ function mkdirRecursive(dir) {
27
+ var parts = path.normalize(dir).split(path.sep);
28
+ dir = '';
29
+ for (var i = 0; i < parts.length; i++) {
30
+ dir += parts[i] + path.sep;
31
+ if (!existsSync(dir)) {
32
+ fs.mkdirSync(dir, 0x1FD); // 0775 permissions
33
+ }
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Removes the common prefix of basedir and filedir from filedir
39
+ * @param {string} basedir
40
+ * @param {string} filedir
41
+ */
42
+ function removeCommonPrefix(basedir, filedir) {
43
+ var baseparts = basedir.split(path.sep);
44
+ var fileparts = filedir.split(path.sep);
45
+
46
+ var i = 0;
47
+ while (i < fileparts.length && fileparts[i] === baseparts[i]) {
48
+ i++;
49
+ }
50
+ return fileparts.slice(i).join(path.sep);
51
+ }
52
+
53
+ function writeFile(filename, contents) {
54
+ // Compute the output path
55
+ var outputdir = fs.realpathSync(process.cwd());
56
+ mkdirRecursive(path.dirname(filename));
57
+ var filedir = fs.realpathSync(path.dirname(filename));
58
+ filedir = removeCommonPrefix(outputdir, filedir);
59
+ outputdir = path.join(outputdir, filedir);
60
+
61
+ mkdirRecursive(outputdir);
62
+ var outputfile = path.join(outputdir, path.basename(filename));
63
+ fs.writeFileSync(outputfile, contents, 'utf8');
64
+ }
65
+
66
+ function normalizePath(s) {
67
+ return path.sep == '\\' ? s.replace(/\\/g, '/') : s;
68
+ }
69
+
70
+ exports.mkdirRecursive = mkdirRecursive;
71
+ exports.normalizePath = normalizePath;
72
+ exports.removeCommonPrefix = removeCommonPrefix;
73
+ exports.writeFile = writeFile;
@@ -0,0 +1,147 @@
1
+ // Copyright 2013 Traceur Authors.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ var format = require('util').format;
16
+
17
+ function addAbbrev(o) {
18
+ var ks = [''].concat(Object.keys(o).sort()), k, kprev = '';
19
+ for (var i = ks.length - 1; i > 0; i--) {
20
+ var ka = k = ks[i], pre = 0;
21
+
22
+ // find length of common prefix, clamp to min of 1.
23
+ while (kprev[pre] === k[pre]) {
24
+ pre++;
25
+ }
26
+ pre = pre || 1;
27
+
28
+ // add all unique prefixes for k.
29
+ while (!o[ka = ka.slice(0, -1)] && ka.length > pre && ka > ks[i - 1]) {
30
+ o[ka] = o[k];
31
+ }
32
+ kprev = k;
33
+ }
34
+ }
35
+
36
+ function Getopt(opts) {
37
+ this.opt = null;
38
+ this.optarg = null;
39
+ this.optopt = null;
40
+ this.optdata = null;
41
+
42
+ this.optind = 2;
43
+ this.nextchar = 0;
44
+
45
+ this.opts_ = Object.create(null);
46
+ for (var i = 0; i < opts.length; i++) {
47
+ var opt = opts[i], data = null, m;
48
+ if (Array.isArray(opt)) {
49
+ data = opt[1] || null;
50
+ opt = opt[0];
51
+ }
52
+ if (!(m = opt.match(/^([\w\-]+)(:{0,2})$/))) {
53
+ throw new Error('invalid option initializer: ' + opt);
54
+ }
55
+ this.opts_[m[1]] = {name: m[1], arg: m[2], data: data};
56
+ }
57
+ addAbbrev(this.opts_);
58
+ }
59
+
60
+ Getopt.prototype = {
61
+ getopt: function(argv) {
62
+ var m, arg, optInf;
63
+ this.opt = this.optarg = this.optopt = this.optdata = null;
64
+ if (this.optind >= argv.length) {
65
+ return false;
66
+ }
67
+ arg = argv[this.optind];
68
+ if (!this.nextchar && /^-[^\-]/.test(arg)) {
69
+ this.nextchar = 1;
70
+ }
71
+ if (this.nextchar) {
72
+ // short opt
73
+ this.opt = arg[this.nextchar] || null;
74
+ this.optarg = arg.slice(++this.nextchar) || null;
75
+ } else if (m = arg.match(/^--([^=]+)(?:=(.*))?$|^--(.+)$/)) {
76
+ // long opt
77
+ this.opt = m[1] || m[3];
78
+ this.optarg = m[2] === undefined ? null : m[2];
79
+ } else {
80
+ // free arg
81
+ this.optind++;
82
+ this.opt = '=';
83
+ this.optarg = arg;
84
+ return true;
85
+ }
86
+
87
+ if (optInf = this.opts_[this.opt]) {
88
+ this.opt = optInf.name;
89
+ this.optdata = optInf.data;
90
+ switch (optInf.arg) {
91
+ case '':
92
+ // no arg
93
+ if (!this.nextchar && this.optarg) {
94
+ // unexpected arg
95
+ this.optopt = this.opt;
96
+ this.opt = '!';
97
+ break;
98
+ }
99
+ this.optarg = null;
100
+ break;
101
+ case ':':
102
+ // required arg
103
+ if (this.optarg === null) {
104
+ if (++this.optind >= argv.length) {
105
+ // missing arg
106
+ this.optopt = this.opt;
107
+ this.opt = ':';
108
+ break;
109
+ }
110
+ this.optarg = argv[this.optind];
111
+ }
112
+ // fall through
113
+ case '::':
114
+ // optional arg
115
+ this.nextchar = 0;
116
+ break;
117
+ }
118
+ } else {
119
+ // unknown opt
120
+ this.optopt = this.opt;
121
+ this.opt = '?';
122
+ }
123
+
124
+ this.optind += !(this.nextchar %= arg.length);
125
+
126
+ return true;
127
+ },
128
+ message: function() {
129
+ switch (this.opt) {
130
+ case ':':
131
+ return format('missing argument for \'%s\'.', this.optopt);
132
+ case '?':
133
+ return format('unknown option \'%s\'.', this.optopt);
134
+ case '!':
135
+ return format('\'%s\' does not take an argument.', this.optopt);
136
+ case '=':
137
+ return format('optarg \'%s\'.', this.optarg);
138
+ default:
139
+ if (this.optarg === null)
140
+ return format('opt \'%s\'.', this.opt);
141
+ else
142
+ return format('opt \'%s\', optarg \'%s\'.', this.opt, this.optarg);
143
+ }
144
+ }
145
+ }
146
+
147
+ exports.Getopt = Getopt;