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
@@ -0,0 +1,649 @@
1
+ // Approach:
2
+ //
3
+ // 1. Get the minimatch set
4
+ // 2. For each pattern in the set, PROCESS(pattern, false)
5
+ // 3. Store matches per-set, then uniq them
6
+ //
7
+ // PROCESS(pattern, inGlobStar)
8
+ // Get the first [n] items from pattern that are all strings
9
+ // Join these together. This is PREFIX.
10
+ // If there is no more remaining, then stat(PREFIX) and
11
+ // add to matches if it succeeds. END.
12
+ //
13
+ // If inGlobStar and PREFIX is symlink and points to dir
14
+ // set ENTRIES = []
15
+ // else readdir(PREFIX) as ENTRIES
16
+ // If fail, END
17
+ //
18
+ // with ENTRIES
19
+ // If pattern[n] is GLOBSTAR
20
+ // // handle the case where the globstar match is empty
21
+ // // by pruning it out, and testing the resulting pattern
22
+ // PROCESS(pattern[0..n] + pattern[n+1 .. $], false)
23
+ // // handle other cases.
24
+ // for ENTRY in ENTRIES (not dotfiles)
25
+ // // attach globstar + tail onto the entry
26
+ // // Mark that this entry is a globstar match
27
+ // PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
28
+ //
29
+ // else // not globstar
30
+ // for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
31
+ // Test ENTRY against pattern[n]
32
+ // If fails, continue
33
+ // If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
34
+ //
35
+ // Caveat:
36
+ // Cache all stats and readdirs results to minimize syscall. Since all
37
+ // we ever care about is existence and directory-ness, we can just keep
38
+ // `true` for files, and [children,...] for directories, or `false` for
39
+ // things that don't exist.
40
+
41
+ module.exports = glob
42
+
43
+ var fs = require('fs')
44
+ var minimatch = require('minimatch')
45
+ var Minimatch = minimatch.Minimatch
46
+ var inherits = require('inherits')
47
+ var EE = require('events').EventEmitter
48
+ var path = require('path')
49
+ var assert = require('assert')
50
+ var globSync = require('./sync.js')
51
+ var common = require('./common.js')
52
+ var alphasort = common.alphasort
53
+ var alphasorti = common.alphasorti
54
+ var isAbsolute = common.isAbsolute
55
+ var setopts = common.setopts
56
+ var ownProp = common.ownProp
57
+ var inflight = require('inflight')
58
+ var util = require('util')
59
+
60
+ var once = require('once')
61
+
62
+ function glob (pattern, options, cb) {
63
+ if (typeof options === 'function') cb = options, options = {}
64
+ if (!options) options = {}
65
+
66
+ if (options.sync) {
67
+ if (cb)
68
+ throw new TypeError('callback provided to sync glob')
69
+ return globSync(pattern, options)
70
+ }
71
+
72
+ return new Glob(pattern, options, cb)
73
+ }
74
+
75
+ glob.sync = globSync
76
+ var GlobSync = glob.GlobSync = globSync.GlobSync
77
+
78
+ // old api surface
79
+ glob.glob = glob
80
+
81
+ glob.hasMagic = function (pattern, options_) {
82
+ var options = util._extend({}, options_)
83
+ options.noprocess = true
84
+
85
+ var g = new Glob(pattern, options)
86
+ var set = g.minimatch.set
87
+ if (set.length > 1)
88
+ return true
89
+
90
+ for (var j = 0; j < set[0].length; j++) {
91
+ if (typeof set[0][j] !== 'string')
92
+ return true
93
+ }
94
+
95
+ return false
96
+ }
97
+
98
+ glob.Glob = Glob
99
+ inherits(Glob, EE)
100
+ function Glob (pattern, options, cb) {
101
+ if (typeof options === 'function') {
102
+ cb = options
103
+ options = null
104
+ }
105
+
106
+ if (options && options.sync) {
107
+ if (cb)
108
+ throw new TypeError('callback provided to sync glob')
109
+ return new GlobSync(pattern, options)
110
+ }
111
+
112
+ if (!(this instanceof Glob))
113
+ return new Glob(pattern, options, cb)
114
+
115
+ setopts(this, pattern, options)
116
+
117
+ // process each pattern in the minimatch set
118
+ var n = this.minimatch.set.length
119
+
120
+ // The matches are stored as {<filename>: true,...} so that
121
+ // duplicates are automagically pruned.
122
+ // Later, we do an Object.keys() on these.
123
+ // Keep them as a list so we can fill in when nonull is set.
124
+ this.matches = new Array(n)
125
+
126
+ if (typeof cb === 'function') {
127
+ cb = once(cb)
128
+ this.on('error', cb)
129
+ this.on('end', function (matches) {
130
+ cb(null, matches)
131
+ })
132
+ }
133
+
134
+ var self = this
135
+ var n = this.minimatch.set.length
136
+ this._processing = 0
137
+ this.matches = new Array(n)
138
+
139
+ this._emitQueue = []
140
+ this._processQueue = []
141
+ this.paused = false
142
+
143
+ if (this.noprocess)
144
+ return this
145
+
146
+ if (n === 0)
147
+ return done()
148
+
149
+ for (var i = 0; i < n; i ++) {
150
+ this._process(this.minimatch.set[i], i, false, done)
151
+ }
152
+
153
+ function done () {
154
+ --self._processing
155
+ if (self._processing <= 0)
156
+ self._finish()
157
+ }
158
+ }
159
+
160
+ Glob.prototype._finish = function () {
161
+ assert(this instanceof Glob)
162
+ if (this.aborted)
163
+ return
164
+
165
+ //console.error('FINISH', this.matches)
166
+ common.finish(this)
167
+ this.emit('end', this.found)
168
+ }
169
+
170
+ Glob.prototype._mark = function (p) {
171
+ return common.mark(this, p)
172
+ }
173
+
174
+ Glob.prototype._makeAbs = function (f) {
175
+ return common.makeAbs(this, f)
176
+ }
177
+
178
+ Glob.prototype.abort = function () {
179
+ this.aborted = true
180
+ this.emit('abort')
181
+ }
182
+
183
+ Glob.prototype.pause = function () {
184
+ if (!this.paused) {
185
+ this.paused = true
186
+ this.emit('pause')
187
+ }
188
+ }
189
+
190
+ Glob.prototype.resume = function () {
191
+ if (this.paused) {
192
+ this.emit('resume')
193
+ this.paused = false
194
+ if (this._emitQueue.length) {
195
+ var eq = this._emitQueue.slice(0)
196
+ this._emitQueue.length = 0
197
+ for (var i = 0; i < eq.length; i ++) {
198
+ var e = eq[i]
199
+ this._emitMatch(e[0], e[1])
200
+ }
201
+ }
202
+ if (this._processQueue.length) {
203
+ var pq = this._processQueue.slice(0)
204
+ this._processQueue.length = 0
205
+ for (var i = 0; i < pq.length; i ++) {
206
+ var p = pq[i]
207
+ this._processing--
208
+ this._process(p[0], p[1], p[2], p[3])
209
+ }
210
+ }
211
+ }
212
+ }
213
+
214
+ Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
215
+ assert(this instanceof Glob)
216
+ assert(typeof cb === 'function')
217
+
218
+ if (this.aborted)
219
+ return
220
+
221
+ this._processing++
222
+ if (this.paused) {
223
+ this._processQueue.push([pattern, index, inGlobStar, cb])
224
+ return
225
+ }
226
+
227
+ //console.error('PROCESS %d', this._processing, pattern)
228
+
229
+ // Get the first [n] parts of pattern that are all strings.
230
+ var n = 0
231
+ while (typeof pattern[n] === 'string') {
232
+ n ++
233
+ }
234
+ // now n is the index of the first one that is *not* a string.
235
+
236
+ // see if there's anything else
237
+ var prefix
238
+ switch (n) {
239
+ // if not, then this is rather simple
240
+ case pattern.length:
241
+ this._processSimple(pattern.join('/'), index, cb)
242
+ return
243
+
244
+ case 0:
245
+ // pattern *starts* with some non-trivial item.
246
+ // going to readdir(cwd), but not include the prefix in matches.
247
+ prefix = null
248
+ break
249
+
250
+ default:
251
+ // pattern has some string bits in the front.
252
+ // whatever it starts with, whether that's 'absolute' like /foo/bar,
253
+ // or 'relative' like '../baz'
254
+ prefix = pattern.slice(0, n).join('/')
255
+ break
256
+ }
257
+
258
+ var remain = pattern.slice(n)
259
+
260
+ // get the list of entries.
261
+ var read
262
+ if (prefix === null)
263
+ read = '.'
264
+ else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
265
+ if (!prefix || !isAbsolute(prefix))
266
+ prefix = '/' + prefix
267
+ read = prefix
268
+ } else
269
+ read = prefix
270
+
271
+ var abs = this._makeAbs(read)
272
+
273
+ var isGlobStar = remain[0] === minimatch.GLOBSTAR
274
+ if (isGlobStar)
275
+ this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb)
276
+ else
277
+ this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb)
278
+ }
279
+
280
+
281
+ Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
282
+ var self = this
283
+ this._readdir(abs, inGlobStar, function (er, entries) {
284
+ return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
285
+ })
286
+ }
287
+
288
+ Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
289
+
290
+ // if the abs isn't a dir, then nothing can match!
291
+ if (!entries)
292
+ return cb()
293
+
294
+ // It will only match dot entries if it starts with a dot, or if
295
+ // dot is set. Stuff like @(.foo|.bar) isn't allowed.
296
+ var pn = remain[0]
297
+ var negate = !!this.minimatch.negate
298
+ var rawGlob = pn._glob
299
+ var dotOk = this.dot || rawGlob.charAt(0) === '.'
300
+
301
+ var matchedEntries = []
302
+ for (var i = 0; i < entries.length; i++) {
303
+ var e = entries[i]
304
+ if (e.charAt(0) !== '.' || dotOk) {
305
+ var m
306
+ if (negate && !prefix) {
307
+ m = !e.match(pn)
308
+ } else {
309
+ m = e.match(pn)
310
+ }
311
+ if (m)
312
+ matchedEntries.push(e)
313
+ }
314
+ }
315
+
316
+ //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries)
317
+
318
+ var len = matchedEntries.length
319
+ // If there are no matched entries, then nothing matches.
320
+ if (len === 0)
321
+ return cb()
322
+
323
+ // if this is the last remaining pattern bit, then no need for
324
+ // an additional stat *unless* the user has specified mark or
325
+ // stat explicitly. We know they exist, since readdir returned
326
+ // them.
327
+
328
+ if (remain.length === 1 && !this.mark && !this.stat) {
329
+ if (!this.matches[index])
330
+ this.matches[index] = Object.create(null)
331
+
332
+ for (var i = 0; i < len; i ++) {
333
+ var e = matchedEntries[i]
334
+ if (prefix) {
335
+ if (prefix !== '/')
336
+ e = prefix + '/' + e
337
+ else
338
+ e = prefix + e
339
+ }
340
+
341
+ if (e.charAt(0) === '/' && !this.nomount) {
342
+ e = path.join(this.root, e)
343
+ }
344
+ this._emitMatch(index, e)
345
+ }
346
+ // This was the last one, and no stats were needed
347
+ return cb()
348
+ }
349
+
350
+ // now test all matched entries as stand-ins for that part
351
+ // of the pattern.
352
+ remain.shift()
353
+ for (var i = 0; i < len; i ++) {
354
+ var e = matchedEntries[i]
355
+ var newPattern
356
+ if (prefix) {
357
+ if (prefix !== '/')
358
+ e = prefix + '/' + e
359
+ else
360
+ e = prefix + e
361
+ }
362
+ this._process([e].concat(remain), index, inGlobStar, cb)
363
+ }
364
+ cb()
365
+ }
366
+
367
+ Glob.prototype._emitMatch = function (index, e) {
368
+ if (this.aborted)
369
+ return
370
+
371
+ if (!this.matches[index][e]) {
372
+ if (this.paused) {
373
+ this._emitQueue.push([index, e])
374
+ return
375
+ }
376
+
377
+ if (this.nodir) {
378
+ var c = this.cache[this._makeAbs(e)]
379
+ if (c === 'DIR' || Array.isArray(c))
380
+ return
381
+ }
382
+
383
+ this.matches[index][e] = true
384
+ if (!this.stat && !this.mark)
385
+ return this.emit('match', e)
386
+
387
+ var self = this
388
+ this._stat(this._makeAbs(e), function (er, c, st) {
389
+ self.emit('stat', e, st)
390
+ self.emit('match', e)
391
+ })
392
+ }
393
+ }
394
+
395
+ Glob.prototype._readdirInGlobStar = function (abs, cb) {
396
+ if (this.aborted)
397
+ return
398
+
399
+ var lstatkey = 'lstat\0' + abs
400
+ var self = this
401
+ var lstatcb = inflight(lstatkey, lstatcb_)
402
+
403
+ if (lstatcb)
404
+ fs.lstat(abs, lstatcb)
405
+
406
+ function lstatcb_ (er, lstat) {
407
+ if (er)
408
+ return cb()
409
+
410
+ var isSym = lstat.isSymbolicLink()
411
+ self.symlinks[abs] = isSym
412
+
413
+ // If it's not a symlink or a dir, then it's definitely a regular file.
414
+ // don't bother doing a readdir in that case.
415
+ if (!isSym && !lstat.isDirectory()) {
416
+ self.cache[abs] = 'FILE'
417
+ cb()
418
+ } else
419
+ self._readdir(abs, false, cb)
420
+ }
421
+ }
422
+
423
+ Glob.prototype._readdir = function (abs, inGlobStar, cb) {
424
+ if (this.aborted)
425
+ return
426
+
427
+ cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb)
428
+ if (!cb)
429
+ return
430
+
431
+ //console.error('RD %j %j', +inGlobStar, abs)
432
+ if (inGlobStar && !ownProp(this.symlinks, abs))
433
+ return this._readdirInGlobStar(abs, cb)
434
+
435
+ if (ownProp(this.cache, abs)) {
436
+ var c = this.cache[abs]
437
+ if (!c || c === 'FILE')
438
+ return cb()
439
+
440
+ if (Array.isArray(c))
441
+ return cb(null, c)
442
+ }
443
+
444
+ var self = this
445
+ fs.readdir(abs, readdirCb(this, abs, cb))
446
+ }
447
+
448
+ function readdirCb (self, abs, cb) {
449
+ return function (er, entries) {
450
+ if (er)
451
+ self._readdirError(abs, er, cb)
452
+ else
453
+ self._readdirEntries(abs, entries, cb)
454
+ }
455
+ }
456
+
457
+ Glob.prototype._readdirEntries = function (abs, entries, cb) {
458
+ if (this.aborted)
459
+ return
460
+
461
+ // if we haven't asked to stat everything, then just
462
+ // assume that everything in there exists, so we can avoid
463
+ // having to stat it a second time.
464
+ if (!this.mark && !this.stat) {
465
+ for (var i = 0; i < entries.length; i ++) {
466
+ var e = entries[i]
467
+ if (abs === '/')
468
+ e = abs + e
469
+ else
470
+ e = abs + '/' + e
471
+ this.cache[e] = true
472
+ }
473
+ }
474
+
475
+ this.cache[abs] = entries
476
+ return cb(null, entries)
477
+ }
478
+
479
+ Glob.prototype._readdirError = function (f, er, cb) {
480
+ if (this.aborted)
481
+ return
482
+
483
+ // handle errors, and cache the information
484
+ switch (er.code) {
485
+ case 'ENOTDIR': // totally normal. means it *does* exist.
486
+ this.cache[f] = 'FILE'
487
+ break
488
+
489
+ case 'ENOENT': // not terribly unusual
490
+ case 'ELOOP':
491
+ case 'ENAMETOOLONG':
492
+ case 'UNKNOWN':
493
+ this.cache[f] = false
494
+ break
495
+
496
+ default: // some unusual error. Treat as failure.
497
+ this.cache[f] = false
498
+ if (this.strict) return this.emit('error', er)
499
+ if (!this.silent) console.error('glob error', er)
500
+ break
501
+ }
502
+ return cb()
503
+ }
504
+
505
+ Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
506
+ var self = this
507
+ this._readdir(abs, inGlobStar, function (er, entries) {
508
+ self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
509
+ })
510
+ }
511
+
512
+
513
+ Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
514
+ //console.error('pgs2', prefix, remain[0], entries)
515
+
516
+ // no entries means not a dir, so it can never have matches
517
+ // foo.txt/** doesn't match foo.txt
518
+ if (!entries)
519
+ return cb()
520
+
521
+ // test without the globstar, and with every child both below
522
+ // and replacing the globstar.
523
+ var remainWithoutGlobStar = remain.slice(1)
524
+ var gspref = prefix ? [ prefix ] : []
525
+ var noGlobStar = gspref.concat(remainWithoutGlobStar)
526
+
527
+ // the noGlobStar pattern exits the inGlobStar state
528
+ this._process(noGlobStar, index, false, cb)
529
+
530
+ var isSym = this.symlinks[abs]
531
+ var len = entries.length
532
+
533
+ // If it's a symlink, and we're in a globstar, then stop
534
+ if (isSym && inGlobStar)
535
+ return cb()
536
+
537
+ for (var i = 0; i < len; i++) {
538
+ var e = entries[i]
539
+ if (e.charAt(0) === '.' && !this.dot)
540
+ continue
541
+
542
+ // these two cases enter the inGlobStar state
543
+ var instead = gspref.concat(entries[i], remainWithoutGlobStar)
544
+ this._process(instead, index, true, cb)
545
+
546
+ var below = gspref.concat(entries[i], remain)
547
+ this._process(below, index, true, cb)
548
+ }
549
+
550
+ cb()
551
+ }
552
+
553
+ Glob.prototype._processSimple = function (prefix, index, cb) {
554
+ // XXX review this. Shouldn't it be doing the mounting etc
555
+ // before doing stat? kinda weird?
556
+ var self = this
557
+ this._stat(prefix, function (er, exists) {
558
+ self._processSimple2(prefix, index, er, exists, cb)
559
+ })
560
+ }
561
+ Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
562
+
563
+ //console.error('ps2', prefix, exists)
564
+
565
+ if (!this.matches[index])
566
+ this.matches[index] = Object.create(null)
567
+
568
+ // If it doesn't exist, then just mark the lack of results
569
+ if (!exists)
570
+ return cb()
571
+
572
+ if (prefix && isAbsolute(prefix) && !this.nomount) {
573
+ var trail = /[\/\\]$/.test(prefix)
574
+ if (prefix.charAt(0) === '/') {
575
+ prefix = path.join(this.root, prefix)
576
+ } else {
577
+ prefix = path.resolve(this.root, prefix)
578
+ if (trail)
579
+ prefix += '/'
580
+ }
581
+ }
582
+
583
+ if (process.platform === 'win32')
584
+ prefix = prefix.replace(/\\/g, '/')
585
+
586
+ // Mark this as a match
587
+ this._emitMatch(index, prefix)
588
+ cb()
589
+ }
590
+
591
+ // Returns either 'DIR', 'FILE', or false
592
+ Glob.prototype._stat = function (f, cb) {
593
+ var abs = f
594
+ if (f.charAt(0) === '/')
595
+ abs = path.join(this.root, f)
596
+ else if (this.changedCwd)
597
+ abs = path.resolve(this.cwd, f)
598
+
599
+
600
+ if (f.length > this.maxLength)
601
+ return cb()
602
+
603
+ if (!this.stat && ownProp(this.cache, f)) {
604
+ var c = this.cache[f]
605
+
606
+ if (Array.isArray(c))
607
+ c = 'DIR'
608
+
609
+ // It exists, but not how we need it
610
+ if (abs.slice(-1) === '/' && c !== 'DIR')
611
+ return cb()
612
+
613
+ return cb(null, c)
614
+ }
615
+
616
+ var exists
617
+ var stat = this.statCache[abs]
618
+ if (stat !== undefined) {
619
+ if (stat === false)
620
+ return cb(null, stat)
621
+ else
622
+ return cb(null, stat.isDirectory() ? 'DIR' : 'FILE', stat)
623
+ }
624
+
625
+ var self = this
626
+ var statcb = inflight('stat\0' + abs, statcb_)
627
+ if (statcb)
628
+ fs.stat(abs, statcb)
629
+
630
+ function statcb_ (er, stat) {
631
+ self._stat2(f, abs, er, stat, cb)
632
+ }
633
+ }
634
+
635
+ Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
636
+ if (er) {
637
+ this.statCache[abs] = false
638
+ return cb()
639
+ }
640
+
641
+ this.statCache[abs] = stat
642
+
643
+ if (abs.slice(-1) === '/' && !stat.isDirectory())
644
+ return cb(null, false, stat)
645
+
646
+ var c = stat.isDirectory() ? 'DIR' : 'FILE'
647
+ this.cache[f] = this.cache[f] || c
648
+ return cb(null, c, stat)
649
+ }