stylus-source 0.31.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. checksums.yaml +7 -0
  2. data/VERSION +1 -1
  3. data/vendor/lib/nodes/unit.js +1 -1
  4. data/vendor/lib/parser.js +0 -1
  5. data/vendor/lib/renderer.js +2 -0
  6. data/vendor/lib/visitor/compiler.js +6 -0
  7. data/vendor/node_modules/cssom/README.mdown +34 -0
  8. data/vendor/node_modules/cssom/package.json +2 -1
  9. data/vendor/node_modules/debug/History.md +15 -0
  10. data/vendor/node_modules/debug/Readme.md +3 -18
  11. data/vendor/node_modules/debug/component.json +9 -0
  12. data/vendor/node_modules/debug/debug.js +10 -2
  13. data/vendor/node_modules/debug/index.js +5 -2
  14. data/vendor/node_modules/debug/lib/debug.js +5 -6
  15. data/vendor/node_modules/debug/package.json +11 -6
  16. data/vendor/node_modules/mkdirp/package.json +6 -9
  17. data/vendor/node_modules/mkdirp/{README.markdown → readme.markdown} +26 -24
  18. data/vendor/node_modules/mocha/History.md +140 -58
  19. data/vendor/node_modules/mocha/LICENSE +2 -2
  20. data/vendor/node_modules/mocha/Makefile +20 -5
  21. data/vendor/node_modules/mocha/Readme.md +110 -22
  22. data/vendor/node_modules/mocha/_mocha.js +574 -182
  23. data/vendor/node_modules/mocha/bin/_mocha +39 -22
  24. data/vendor/node_modules/mocha/bin/mocha +6 -2
  25. data/vendor/node_modules/mocha/component.json +16 -0
  26. data/vendor/node_modules/mocha/lib/browser/debug.js +1 -2
  27. data/vendor/node_modules/mocha/lib/browser/diff.js +287 -0
  28. data/vendor/node_modules/mocha/lib/browser/tty.js +7 -2
  29. data/vendor/node_modules/mocha/lib/hook.js +0 -1
  30. data/vendor/node_modules/mocha/lib/interfaces/bdd.js +3 -3
  31. data/vendor/node_modules/mocha/lib/interfaces/exports.js +5 -5
  32. data/vendor/node_modules/mocha/lib/interfaces/qunit.js +38 -9
  33. data/vendor/node_modules/mocha/lib/interfaces/tdd.js +15 -2
  34. data/vendor/node_modules/mocha/lib/mocha.js +20 -4
  35. data/vendor/node_modules/mocha/lib/reporters/base.js +57 -37
  36. data/vendor/node_modules/mocha/lib/reporters/html.js +2 -4
  37. data/vendor/node_modules/mocha/lib/reporters/json-stream.js +4 -14
  38. data/vendor/node_modules/mocha/lib/reporters/json.js +9 -19
  39. data/vendor/node_modules/mocha/lib/reporters/markdown.js +0 -1
  40. data/vendor/node_modules/mocha/lib/reporters/min.js +2 -2
  41. data/vendor/node_modules/mocha/lib/reporters/nyan.js +33 -39
  42. data/vendor/node_modules/mocha/lib/reporters/tap.js +12 -2
  43. data/vendor/node_modules/mocha/lib/reporters/templates/coverage.jade +3 -3
  44. data/vendor/node_modules/mocha/lib/reporters/templates/menu.jade +1 -1
  45. data/vendor/node_modules/mocha/lib/reporters/xunit.js +4 -4
  46. data/vendor/node_modules/mocha/lib/runnable.js +7 -9
  47. data/vendor/node_modules/mocha/lib/runner.js +24 -9
  48. data/vendor/node_modules/mocha/lib/template.html +2 -1
  49. data/vendor/node_modules/mocha/lib/utils.js +3 -3
  50. data/vendor/node_modules/mocha/mocha.css +37 -13
  51. data/vendor/node_modules/mocha/mocha.js +661 -253
  52. data/vendor/node_modules/mocha/node_modules/commander/package.json +5 -1
  53. data/vendor/node_modules/mocha/node_modules/diff/package.json +5 -1
  54. data/vendor/node_modules/mocha/node_modules/glob/LICENSE +27 -0
  55. data/vendor/node_modules/mocha/node_modules/glob/README.md +250 -0
  56. data/vendor/node_modules/mocha/node_modules/glob/examples/g.js +9 -0
  57. data/vendor/node_modules/mocha/node_modules/glob/examples/usr-local.js +9 -0
  58. data/vendor/node_modules/mocha/node_modules/glob/glob.js +675 -0
  59. data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/LICENSE +27 -0
  60. data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/README.md +33 -0
  61. data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/graceful-fs.js +442 -0
  62. data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/package.json +49 -0
  63. data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/open.js +46 -0
  64. data/vendor/node_modules/mocha/node_modules/glob/node_modules/graceful-fs/test/ulimit.js +158 -0
  65. data/vendor/node_modules/mocha/node_modules/glob/node_modules/inherits/README.md +51 -0
  66. data/vendor/node_modules/mocha/node_modules/glob/node_modules/inherits/inherits.js +29 -0
  67. data/vendor/node_modules/mocha/node_modules/glob/node_modules/inherits/package.json +26 -0
  68. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/LICENSE +23 -0
  69. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/README.md +218 -0
  70. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/minimatch.js +1079 -0
  71. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/AUTHORS +8 -0
  72. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/LICENSE +23 -0
  73. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/README.md +97 -0
  74. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js +257 -0
  75. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/package.json +59 -0
  76. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/s.js +25 -0
  77. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/basic.js +329 -0
  78. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/foreach.js +52 -0
  79. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js +50 -0
  80. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/LICENSE +27 -0
  81. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/README.md +53 -0
  82. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/bench.js +283 -0
  83. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/package.json +38 -0
  84. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/sigmund.js +39 -0
  85. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/test/basic.js +24 -0
  86. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/package.json +36 -0
  87. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/basic.js +399 -0
  88. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/brace-expand.js +33 -0
  89. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/caching.js +14 -0
  90. data/vendor/node_modules/mocha/node_modules/glob/node_modules/minimatch/test/defaults.js +274 -0
  91. data/vendor/node_modules/mocha/node_modules/glob/package.json +40 -0
  92. data/vendor/node_modules/mocha/node_modules/glob/test/00-setup.js +176 -0
  93. data/vendor/node_modules/mocha/node_modules/glob/test/bash-comparison.js +63 -0
  94. data/vendor/node_modules/mocha/node_modules/glob/test/bash-results.json +350 -0
  95. data/vendor/node_modules/mocha/node_modules/glob/test/cwd-test.js +55 -0
  96. data/vendor/node_modules/mocha/node_modules/glob/test/globstar-match.js +19 -0
  97. data/vendor/node_modules/mocha/node_modules/glob/test/mark.js +74 -0
  98. data/vendor/node_modules/mocha/node_modules/glob/test/nocase-nomagic.js +113 -0
  99. data/vendor/node_modules/mocha/node_modules/glob/test/pause-resume.js +73 -0
  100. data/vendor/node_modules/mocha/node_modules/glob/test/root-nomount.js +39 -0
  101. data/vendor/node_modules/mocha/node_modules/glob/test/root.js +46 -0
  102. data/vendor/node_modules/mocha/node_modules/glob/test/stat.js +32 -0
  103. data/vendor/node_modules/mocha/node_modules/glob/test/zz-cleanup.js +11 -0
  104. data/vendor/node_modules/mocha/node_modules/growl/History.md +5 -0
  105. data/vendor/node_modules/mocha/node_modules/growl/lib/growl.js +2 -0
  106. data/vendor/node_modules/mocha/node_modules/growl/package.json +7 -3
  107. data/vendor/node_modules/mocha/node_modules/jade/node_modules/mkdirp/package.json +5 -1
  108. data/vendor/node_modules/mocha/node_modules/jade/package.json +5 -1
  109. data/vendor/node_modules/mocha/node_modules/ms/package.json +5 -1
  110. data/vendor/node_modules/mocha/package.json +13 -7
  111. data/vendor/node_modules/mocha/test.js +10 -21
  112. data/vendor/node_modules/should/History.md +5 -0
  113. data/vendor/node_modules/should/Readme.md +172 -172
  114. data/vendor/node_modules/should/lib/eql.js +2 -0
  115. data/vendor/node_modules/should/lib/should.js +4 -3
  116. data/vendor/node_modules/should/package.json +8 -4
  117. data/vendor/node_modules/should/test/should.test.js +27 -0
  118. data/vendor/package.json +1 -1
  119. metadata +61 -35
  120. data/vendor/node_modules/debug/Makefile +0 -4
  121. data/vendor/node_modules/debug/debug.component.js +0 -120
  122. data/vendor/node_modules/debug/head.js +0 -1
  123. data/vendor/node_modules/debug/tail.js +0 -4
  124. data/vendor/node_modules/mocha/node_modules/mkdirp/LICENSE +0 -21
  125. data/vendor/node_modules/mocha/node_modules/mkdirp/README.markdown +0 -61
  126. data/vendor/node_modules/mocha/node_modules/mkdirp/examples/pow.js +0 -6
  127. data/vendor/node_modules/mocha/node_modules/mkdirp/examples/pow.js.orig +0 -6
  128. data/vendor/node_modules/mocha/node_modules/mkdirp/examples/pow.js.rej +0 -19
  129. data/vendor/node_modules/mocha/node_modules/mkdirp/index.js +0 -94
  130. data/vendor/node_modules/mocha/node_modules/mkdirp/package.json +0 -33
  131. data/vendor/node_modules/mocha/node_modules/mkdirp/test/chmod.js +0 -38
  132. data/vendor/node_modules/mocha/node_modules/mkdirp/test/clobber.js +0 -37
  133. data/vendor/node_modules/mocha/node_modules/mkdirp/test/mkdirp.js +0 -28
  134. data/vendor/node_modules/mocha/node_modules/mkdirp/test/perm.js +0 -32
  135. data/vendor/node_modules/mocha/node_modules/mkdirp/test/perm_sync.js +0 -39
  136. data/vendor/node_modules/mocha/node_modules/mkdirp/test/race.js +0 -41
  137. data/vendor/node_modules/mocha/node_modules/mkdirp/test/rel.js +0 -32
  138. data/vendor/node_modules/mocha/node_modules/mkdirp/test/return.js +0 -25
  139. data/vendor/node_modules/mocha/node_modules/mkdirp/test/return_sync.js +0 -24
  140. data/vendor/node_modules/mocha/node_modules/mkdirp/test/root.js +0 -18
  141. data/vendor/node_modules/mocha/node_modules/mkdirp/test/sync.js +0 -32
  142. data/vendor/node_modules/mocha/node_modules/mkdirp/test/umask.js +0 -28
  143. data/vendor/node_modules/mocha/node_modules/mkdirp/test/umask_sync.js +0 -32
@@ -0,0 +1,274 @@
1
+ // http://www.bashcookbook.com/bashinfo/source/bash-1.14.7/tests/glob-test
2
+ //
3
+ // TODO: Some of these tests do very bad things with backslashes, and will
4
+ // most likely fail badly on windows. They should probably be skipped.
5
+
6
+ var tap = require("tap")
7
+ , globalBefore = Object.keys(global)
8
+ , mm = require("../")
9
+ , files = [ "a", "b", "c", "d", "abc"
10
+ , "abd", "abe", "bb", "bcd"
11
+ , "ca", "cb", "dd", "de"
12
+ , "bdir/", "bdir/cfile"]
13
+ , next = files.concat([ "a-b", "aXb"
14
+ , ".x", ".y" ])
15
+
16
+ tap.test("basic tests", function (t) {
17
+ var start = Date.now()
18
+
19
+ // [ pattern, [matches], MM opts, files, TAP opts]
20
+ ; [ "http://www.bashcookbook.com/bashinfo" +
21
+ "/source/bash-1.14.7/tests/glob-test"
22
+ , ["a*", ["a", "abc", "abd", "abe"]]
23
+ , ["X*", ["X*"], {nonull: true}]
24
+
25
+ // allow null glob expansion
26
+ , ["X*", []]
27
+
28
+ // isaacs: Slightly different than bash/sh/ksh
29
+ // \\* is not un-escaped to literal "*" in a failed match,
30
+ // but it does make it get treated as a literal star
31
+ , ["\\*", ["\\*"], {nonull: true}]
32
+ , ["\\**", ["\\**"], {nonull: true}]
33
+ , ["\\*\\*", ["\\*\\*"], {nonull: true}]
34
+
35
+ , ["b*/", ["bdir/"]]
36
+ , ["c*", ["c", "ca", "cb"]]
37
+ , ["**", files]
38
+
39
+ , ["\\.\\./*/", ["\\.\\./*/"], {nonull: true}]
40
+ , ["s/\\..*//", ["s/\\..*//"], {nonull: true}]
41
+
42
+ , "legendary larry crashes bashes"
43
+ , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"
44
+ , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"], {nonull: true}]
45
+ , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"
46
+ , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"], {nonull: true}]
47
+
48
+ , "character classes"
49
+ , ["[a-c]b*", ["abc", "abd", "abe", "bb", "cb"]]
50
+ , ["[a-y]*[^c]", ["abd", "abe", "bb", "bcd",
51
+ "bdir/", "ca", "cb", "dd", "de"]]
52
+ , ["a*[^c]", ["abd", "abe"]]
53
+ , function () { files.push("a-b", "aXb") }
54
+ , ["a[X-]b", ["a-b", "aXb"]]
55
+ , function () { files.push(".x", ".y") }
56
+ , ["[^a-c]*", ["d", "dd", "de"]]
57
+ , function () { files.push("a*b/", "a*b/ooo") }
58
+ , ["a\\*b/*", ["a*b/ooo"]]
59
+ , ["a\\*?/*", ["a*b/ooo"]]
60
+ , ["*\\\\!*", [], {null: true}, ["echo !7"]]
61
+ , ["*\\!*", ["echo !7"], null, ["echo !7"]]
62
+ , ["*.\\*", ["r.*"], null, ["r.*"]]
63
+ , ["a[b]c", ["abc"]]
64
+ , ["a[\\b]c", ["abc"]]
65
+ , ["a?c", ["abc"]]
66
+ , ["a\\*c", [], {null: true}, ["abc"]]
67
+ , ["", [""], { null: true }, [""]]
68
+
69
+ , "http://www.opensource.apple.com/source/bash/bash-23/" +
70
+ "bash/tests/glob-test"
71
+ , function () { files.push("man/", "man/man1/", "man/man1/bash.1") }
72
+ , ["*/man*/bash.*", ["man/man1/bash.1"]]
73
+ , ["man/man1/bash.1", ["man/man1/bash.1"]]
74
+ , ["a***c", ["abc"], null, ["abc"]]
75
+ , ["a*****?c", ["abc"], null, ["abc"]]
76
+ , ["?*****??", ["abc"], null, ["abc"]]
77
+ , ["*****??", ["abc"], null, ["abc"]]
78
+ , ["?*****?c", ["abc"], null, ["abc"]]
79
+ , ["?***?****c", ["abc"], null, ["abc"]]
80
+ , ["?***?****?", ["abc"], null, ["abc"]]
81
+ , ["?***?****", ["abc"], null, ["abc"]]
82
+ , ["*******c", ["abc"], null, ["abc"]]
83
+ , ["*******?", ["abc"], null, ["abc"]]
84
+ , ["a*cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
85
+ , ["a**?**cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
86
+ , ["a**?**cd**?**??k***", ["abcdecdhjk"], null, ["abcdecdhjk"]]
87
+ , ["a**?**cd**?**??***k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
88
+ , ["a**?**cd**?**??***k**", ["abcdecdhjk"], null, ["abcdecdhjk"]]
89
+ , ["a****c**?**??*****", ["abcdecdhjk"], null, ["abcdecdhjk"]]
90
+ , ["[-abc]", ["-"], null, ["-"]]
91
+ , ["[abc-]", ["-"], null, ["-"]]
92
+ , ["\\", ["\\"], null, ["\\"]]
93
+ , ["[\\\\]", ["\\"], null, ["\\"]]
94
+ , ["[[]", ["["], null, ["["]]
95
+ , ["[", ["["], null, ["["]]
96
+ , ["[*", ["[abc"], null, ["[abc"]]
97
+ , "a right bracket shall lose its special meaning and\n" +
98
+ "represent itself in a bracket expression if it occurs\n" +
99
+ "first in the list. -- POSIX.2 2.8.3.2"
100
+ , ["[]]", ["]"], null, ["]"]]
101
+ , ["[]-]", ["]"], null, ["]"]]
102
+ , ["[a-\z]", ["p"], null, ["p"]]
103
+ , ["??**********?****?", [], { null: true }, ["abc"]]
104
+ , ["??**********?****c", [], { null: true }, ["abc"]]
105
+ , ["?************c****?****", [], { null: true }, ["abc"]]
106
+ , ["*c*?**", [], { null: true }, ["abc"]]
107
+ , ["a*****c*?**", [], { null: true }, ["abc"]]
108
+ , ["a********???*******", [], { null: true }, ["abc"]]
109
+ , ["[]", [], { null: true }, ["a"]]
110
+ , ["[abc", [], { null: true }, ["["]]
111
+
112
+ , "nocase tests"
113
+ , ["XYZ", ["xYz"], { nocase: true, null: true }
114
+ , ["xYz", "ABC", "IjK"]]
115
+ , ["ab*", ["ABC"], { nocase: true, null: true }
116
+ , ["xYz", "ABC", "IjK"]]
117
+ , ["[ia]?[ck]", ["ABC", "IjK"], { nocase: true, null: true }
118
+ , ["xYz", "ABC", "IjK"]]
119
+
120
+ // [ pattern, [matches], MM opts, files, TAP opts]
121
+ , "onestar/twostar"
122
+ , ["{/*,*}", [], {null: true}, ["/asdf/asdf/asdf"]]
123
+ , ["{/?,*}", ["/a", "bb"], {null: true}
124
+ , ["/a", "/b/b", "/a/b/c", "bb"]]
125
+
126
+ , "dots should not match unless requested"
127
+ , ["**", ["a/b"], {}, ["a/b", "a/.d", ".a/.d"]]
128
+
129
+ // .. and . can only match patterns starting with .,
130
+ // even when options.dot is set.
131
+ , function () {
132
+ files = ["a/./b", "a/../b", "a/c/b", "a/.d/b"]
133
+ }
134
+ , ["a/*/b", ["a/c/b", "a/.d/b"], {dot: true}]
135
+ , ["a/.*/b", ["a/./b", "a/../b", "a/.d/b"], {dot: true}]
136
+ , ["a/*/b", ["a/c/b"], {dot:false}]
137
+ , ["a/.*/b", ["a/./b", "a/../b", "a/.d/b"], {dot: false}]
138
+
139
+
140
+ // this also tests that changing the options needs
141
+ // to change the cache key, even if the pattern is
142
+ // the same!
143
+ , ["**", ["a/b","a/.d",".a/.d"], { dot: true }
144
+ , [ ".a/.d", "a/.d", "a/b"]]
145
+
146
+ , "paren sets cannot contain slashes"
147
+ , ["*(a/b)", ["*(a/b)"], {nonull: true}, ["a/b"]]
148
+
149
+ // brace sets trump all else.
150
+ //
151
+ // invalid glob pattern. fails on bash4 and bsdglob.
152
+ // however, in this implementation, it's easier just
153
+ // to do the intuitive thing, and let brace-expansion
154
+ // actually come before parsing any extglob patterns,
155
+ // like the documentation seems to say.
156
+ //
157
+ // XXX: if anyone complains about this, either fix it
158
+ // or tell them to grow up and stop complaining.
159
+ //
160
+ // bash/bsdglob says this:
161
+ // , ["*(a|{b),c)}", ["*(a|{b),c)}"], {}, ["a", "ab", "ac", "ad"]]
162
+ // but we do this instead:
163
+ , ["*(a|{b),c)}", ["a", "ab", "ac"], {}, ["a", "ab", "ac", "ad"]]
164
+
165
+ // test partial parsing in the presence of comment/negation chars
166
+ , ["[!a*", ["[!ab"], {}, ["[!ab", "[ab"]]
167
+ , ["[#a*", ["[#ab"], {}, ["[#ab", "[ab"]]
168
+
169
+ // like: {a,b|c\\,d\\\|e} except it's unclosed, so it has to be escaped.
170
+ , ["+(a|*\\|c\\\\|d\\\\\\|e\\\\\\\\|f\\\\\\\\\\|g"
171
+ , ["+(a|b\\|c\\\\|d\\\\|e\\\\\\\\|f\\\\\\\\|g"]
172
+ , {}
173
+ , ["+(a|b\\|c\\\\|d\\\\|e\\\\\\\\|f\\\\\\\\|g", "a", "b\\c"]]
174
+
175
+
176
+ // crazy nested {,,} and *(||) tests.
177
+ , function () {
178
+ files = [ "a", "b", "c", "d"
179
+ , "ab", "ac", "ad"
180
+ , "bc", "cb"
181
+ , "bc,d", "c,db", "c,d"
182
+ , "d)", "(b|c", "*(b|c"
183
+ , "b|c", "b|cc", "cb|c"
184
+ , "x(a|b|c)", "x(a|c)"
185
+ , "(a|b|c)", "(a|c)"]
186
+ }
187
+ , ["*(a|{b,c})", ["a", "b", "c", "ab", "ac"]]
188
+ , ["{a,*(b|c,d)}", ["a","(b|c", "*(b|c", "d)"]]
189
+ // a
190
+ // *(b|c)
191
+ // *(b|d)
192
+ , ["{a,*(b|{c,d})}", ["a","b", "bc", "cb", "c", "d"]]
193
+ , ["*(a|{b|c,c})", ["a", "b", "c", "ab", "ac", "bc", "cb"]]
194
+
195
+
196
+ // test various flag settings.
197
+ , [ "*(a|{b|c,c})", ["x(a|b|c)", "x(a|c)", "(a|b|c)", "(a|c)"]
198
+ , { noext: true } ]
199
+ , ["a?b", ["x/y/acb", "acb/"], {matchBase: true}
200
+ , ["x/y/acb", "acb/", "acb/d/e", "x/y/acb/d"] ]
201
+ , ["#*", ["#a", "#b"], {nocomment: true}, ["#a", "#b", "c#d"]]
202
+
203
+
204
+ // begin channelling Boole and deMorgan...
205
+ , "negation tests"
206
+ , function () {
207
+ files = ["d", "e", "!ab", "!abc", "a!b", "\\!a"]
208
+ }
209
+
210
+ // anything that is NOT a* matches.
211
+ , ["!a*", ["\\!a", "d", "e", "!ab", "!abc"]]
212
+
213
+ // anything that IS !a* matches.
214
+ , ["!a*", ["!ab", "!abc"], {nonegate: true}]
215
+
216
+ // anything that IS a* matches
217
+ , ["!!a*", ["a!b"]]
218
+
219
+ // anything that is NOT !a* matches
220
+ , ["!\\!a*", ["a!b", "d", "e", "\\!a"]]
221
+
222
+ // negation nestled within a pattern
223
+ , function () {
224
+ files = [ "foo.js"
225
+ , "foo.bar"
226
+ // can't match this one without negative lookbehind.
227
+ , "foo.js.js"
228
+ , "blar.js"
229
+ , "foo."
230
+ , "boo.js.boo" ]
231
+ }
232
+ , ["*.!(js)", ["foo.bar", "foo.", "boo.js.boo"] ]
233
+
234
+ ].forEach(function (c) {
235
+ if (typeof c === "function") return c()
236
+ if (typeof c === "string") return t.comment(c)
237
+
238
+ var pattern = c[0]
239
+ , expect = c[1].sort(alpha)
240
+ , options = c[2] || {}
241
+ , f = c[3] || files
242
+ , tapOpts = c[4] || {}
243
+
244
+ // options.debug = true
245
+ var Class = mm.defaults(options).Minimatch
246
+ var m = new Class(pattern, {})
247
+ var r = m.makeRe()
248
+ tapOpts.re = String(r) || JSON.stringify(r)
249
+ tapOpts.files = JSON.stringify(f)
250
+ tapOpts.pattern = pattern
251
+ tapOpts.set = m.set
252
+ tapOpts.negated = m.negate
253
+
254
+ var actual = mm.match(f, pattern, options)
255
+ actual.sort(alpha)
256
+
257
+ t.equivalent( actual, expect
258
+ , JSON.stringify(pattern) + " " + JSON.stringify(expect)
259
+ , tapOpts )
260
+ })
261
+
262
+ t.comment("time=" + (Date.now() - start) + "ms")
263
+ t.end()
264
+ })
265
+
266
+ tap.test("global leak test", function (t) {
267
+ var globalAfter = Object.keys(global)
268
+ t.equivalent(globalAfter, globalBefore, "no new globals, please")
269
+ t.end()
270
+ })
271
+
272
+ function alpha (a, b) {
273
+ return a > b ? 1 : -1
274
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "author": {
3
+ "name": "Isaac Z. Schlueter",
4
+ "email": "i@izs.me",
5
+ "url": "http://blog.izs.me/"
6
+ },
7
+ "name": "glob",
8
+ "description": "a little globber",
9
+ "version": "3.2.1",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git://github.com/isaacs/node-glob.git"
13
+ },
14
+ "main": "glob.js",
15
+ "engines": {
16
+ "node": "*"
17
+ },
18
+ "dependencies": {
19
+ "minimatch": "~0.2.11",
20
+ "graceful-fs": "~1.2.0",
21
+ "inherits": "1"
22
+ },
23
+ "devDependencies": {
24
+ "tap": "~0.4.0",
25
+ "mkdirp": "0",
26
+ "rimraf": "1"
27
+ },
28
+ "scripts": {
29
+ "test": "tap test/*.js"
30
+ },
31
+ "license": "BSD",
32
+ "readme": "# Glob\n\nMatch files using the patterns the shell uses, like stars and stuff.\n\nThis is a glob implementation in JavaScript. It uses the `minimatch`\nlibrary to do its matching.\n\n## Attention: node-glob users!\n\nThe API has changed dramatically between 2.x and 3.x. This library is\nnow 100% JavaScript, and the integer flags have been replaced with an\noptions object.\n\nAlso, there's an event emitter class, proper tests, and all the other\nthings you've come to expect from node modules.\n\nAnd best of all, no compilation!\n\n## Usage\n\n```javascript\nvar glob = require(\"glob\")\n\n// options is optional\nglob(\"**/*.js\", options, function (er, files) {\n // files is an array of filenames.\n // If the `nonull` option is set, and nothing\n // was found, then files is [\"**/*.js\"]\n // er is an error object or null.\n})\n```\n\n## Features\n\nPlease see the [minimatch\ndocumentation](https://github.com/isaacs/minimatch) for more details.\n\nSupports these glob features:\n\n* Brace Expansion\n* Extended glob matching\n* \"Globstar\" `**` matching\n\nSee:\n\n* `man sh`\n* `man bash`\n* `man 3 fnmatch`\n* `man 5 gitignore`\n* [minimatch documentation](https://github.com/isaacs/minimatch)\n\n## glob(pattern, [options], cb)\n\n* `pattern` {String} Pattern to be matched\n* `options` {Object}\n* `cb` {Function}\n * `err` {Error | null}\n * `matches` {Array<String>} filenames found matching the pattern\n\nPerform an asynchronous glob search.\n\n## glob.sync(pattern, [options])\n\n* `pattern` {String} Pattern to be matched\n* `options` {Object}\n* return: {Array<String>} filenames found matching the pattern\n\nPerform a synchronous glob search.\n\n## Class: glob.Glob\n\nCreate a Glob object by instanting the `glob.Glob` class.\n\n```javascript\nvar Glob = require(\"glob\").Glob\nvar mg = new Glob(pattern, options, cb)\n```\n\nIt's an EventEmitter, and starts walking the filesystem to find matches\nimmediately.\n\n### new glob.Glob(pattern, [options], [cb])\n\n* `pattern` {String} pattern to search for\n* `options` {Object}\n* `cb` {Function} Called when an error occurs, or matches are found\n * `err` {Error | null}\n * `matches` {Array<String>} filenames found matching the pattern\n\nNote that if the `sync` flag is set in the options, then matches will\nbe immediately available on the `g.found` member.\n\n### Properties\n\n* `minimatch` The minimatch object that the glob uses.\n* `options` The options object passed in.\n* `error` The error encountered. When an error is encountered, the\n glob object is in an undefined state, and should be discarded.\n* `aborted` Boolean which is set to true when calling `abort()`. There\n is no way at this time to continue a glob search after aborting, but\n you can re-use the statCache to avoid having to duplicate syscalls.\n* `statCache` Collection of all the stat results the glob search\n performed.\n* `cache` Convenience object. Each field has the following possible\n values:\n * `false` - Path does not exist\n * `true` - Path exists\n * `1` - Path exists, and is not a directory\n * `2` - Path exists, and is a directory\n * `[file, entries, ...]` - Path exists, is a directory, and the\n array value is the results of `fs.readdir`\n\n### Events\n\n* `end` When the matching is finished, this is emitted with all the\n matches found. If the `nonull` option is set, and no match was found,\n then the `matches` list contains the original pattern. The matches\n are sorted, unless the `nosort` flag is set.\n* `match` Every time a match is found, this is emitted with the matched.\n* `error` Emitted when an unexpected error is encountered, or whenever\n any fs error occurs if `options.strict` is set.\n* `abort` When `abort()` is called, this event is raised.\n\n### Methods\n\n* `abort` Stop the search.\n\n### Options\n\nAll the options that can be passed to Minimatch can also be passed to\nGlob to change pattern matching behavior. Also, some have been added,\nor have glob-specific ramifications.\n\nAll options are false by default, unless otherwise noted.\n\nAll options are added to the glob object, as well.\n\n* `cwd` The current working directory in which to search. Defaults\n to `process.cwd()`.\n* `root` The place where patterns starting with `/` will be mounted\n onto. Defaults to `path.resolve(options.cwd, \"/\")` (`/` on Unix\n systems, and `C:\\` or some such on Windows.)\n* `dot` Include `.dot` files in normal matches and `globstar` matches.\n Note that an explicit dot in a portion of the pattern will always\n match dot files.\n* `nomount` By default, a pattern starting with a forward-slash will be\n \"mounted\" onto the root setting, so that a valid filesystem path is\n returned. Set this flag to disable that behavior.\n* `mark` Add a `/` character to directory matches. Note that this\n requires additional stat calls.\n* `nosort` Don't sort the results.\n* `stat` Set to true to stat *all* results. This reduces performance\n somewhat, and is completely unnecessary, unless `readdir` is presumed\n to be an untrustworthy indicator of file existence. It will cause\n ELOOP to be triggered one level sooner in the case of cyclical\n symbolic links.\n* `silent` When an unusual error is encountered\n when attempting to read a directory, a warning will be printed to\n stderr. Set the `silent` option to true to suppress these warnings.\n* `strict` When an unusual error is encountered\n when attempting to read a directory, the process will just continue on\n in search of other matches. Set the `strict` option to raise an error\n in these cases.\n* `cache` See `cache` property above. Pass in a previously generated\n cache object to save some fs calls.\n* `statCache` A cache of results of filesystem information, to prevent\n unnecessary stat calls. While it should not normally be necessary to\n set this, you may pass the statCache from one glob() call to the\n options object of another, if you know that the filesystem will not\n change between calls. (See \"Race Conditions\" below.)\n* `sync` Perform a synchronous glob search.\n* `nounique` In some cases, brace-expanded patterns can result in the\n same file showing up multiple times in the result set. By default,\n this implementation prevents duplicates in the result set.\n Set this flag to disable that behavior.\n* `nonull` Set to never return an empty set, instead returning a set\n containing the pattern itself. This is the default in glob(3).\n* `nocase` Perform a case-insensitive match. Note that case-insensitive\n filesystems will sometimes result in glob returning results that are\n case-insensitively matched anyway, since readdir and stat will not\n raise an error.\n* `debug` Set to enable debug logging in minimatch and glob.\n* `globDebug` Set to enable debug logging in glob, but not minimatch.\n\n## Comparisons to other fnmatch/glob implementations\n\nWhile strict compliance with the existing standards is a worthwhile\ngoal, some discrepancies exist between node-glob and other\nimplementations, and are intentional.\n\nIf the pattern starts with a `!` character, then it is negated. Set the\n`nonegate` flag to suppress this behavior, and treat leading `!`\ncharacters normally. This is perhaps relevant if you wish to start the\npattern with a negative extglob pattern like `!(a|B)`. Multiple `!`\ncharacters at the start of a pattern will negate the pattern multiple\ntimes.\n\nIf a pattern starts with `#`, then it is treated as a comment, and\nwill not match anything. Use `\\#` to match a literal `#` at the\nstart of a line, or set the `nocomment` flag to suppress this behavior.\n\nThe double-star character `**` is supported by default, unless the\n`noglobstar` flag is set. This is supported in the manner of bsdglob\nand bash 4.1, where `**` only has special significance if it is the only\nthing in a path part. That is, `a/**/b` will match `a/x/y/b`, but\n`a/**b` will not.\n\nIf an escaped pattern has no matches, and the `nonull` flag is set,\nthen glob returns the pattern as-provided, rather than\ninterpreting the character escapes. For example,\n`glob.match([], \"\\\\*a\\\\?\")` will return `\"\\\\*a\\\\?\"` rather than\n`\"*a?\"`. This is akin to setting the `nullglob` option in bash, except\nthat it does not resolve escaped pattern characters.\n\nIf brace expansion is not disabled, then it is performed before any\nother interpretation of the glob pattern. Thus, a pattern like\n`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded\n**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are\nchecked for validity. Since those two are valid, matching proceeds.\n\n## Windows\n\n**Please only use forward-slashes in glob expressions.**\n\nThough windows uses either `/` or `\\` as its path separator, only `/`\ncharacters are used by this glob implementation. You must use\nforward-slashes **only** in glob expressions. Back-slashes will always\nbe interpreted as escape characters, not path separators.\n\nResults from absolute patterns such as `/foo/*` are mounted onto the\nroot setting using `path.join`. On windows, this will by default result\nin `/foo/*` matching `C:\\foo\\bar.txt`.\n\n## Race Conditions\n\nGlob searching, by its very nature, is susceptible to race conditions,\nsince it relies on directory walking and such.\n\nAs a result, it is possible that a file that exists when glob looks for\nit may have been deleted or modified by the time it returns the result.\n\nAs part of its internal implementation, this program caches all stat\nand readdir calls that it makes, in order to cut down on system\noverhead. However, this also makes it even more susceptible to races,\nespecially if the cache or statCache objects are reused between glob\ncalls.\n\nUsers are thus advised not to use a glob result as a guarantee of\nfilesystem state in the face of rapid changes. For the vast majority\nof operations, this is never a problem.\n",
33
+ "readmeFilename": "README.md",
34
+ "_id": "glob@3.2.1",
35
+ "dist": {
36
+ "shasum": "e3c79e8967e845154f6bca69752a40fb9a447e15"
37
+ },
38
+ "_from": "glob@3.2.1",
39
+ "_resolved": "https://registry.npmjs.org/glob/-/glob-3.2.1.tgz"
40
+ }
@@ -0,0 +1,176 @@
1
+ // just a little pre-run script to set up the fixtures.
2
+ // zz-finish cleans it up
3
+
4
+ var mkdirp = require("mkdirp")
5
+ var path = require("path")
6
+ var i = 0
7
+ var tap = require("tap")
8
+ var fs = require("fs")
9
+ var rimraf = require("rimraf")
10
+
11
+ var files =
12
+ [ "a/.abcdef/x/y/z/a"
13
+ , "a/abcdef/g/h"
14
+ , "a/abcfed/g/h"
15
+ , "a/b/c/d"
16
+ , "a/bc/e/f"
17
+ , "a/c/d/c/b"
18
+ , "a/cb/e/f"
19
+ ]
20
+
21
+ var symlinkTo = path.resolve(__dirname, "a/symlink/a/b/c")
22
+ var symlinkFrom = "../.."
23
+
24
+ files = files.map(function (f) {
25
+ return path.resolve(__dirname, f)
26
+ })
27
+
28
+ tap.test("remove fixtures", function (t) {
29
+ rimraf(path.resolve(__dirname, "a"), function (er) {
30
+ t.ifError(er, "remove fixtures")
31
+ t.end()
32
+ })
33
+ })
34
+
35
+ files.forEach(function (f) {
36
+ tap.test(f, function (t) {
37
+ var d = path.dirname(f)
38
+ mkdirp(d, 0755, function (er) {
39
+ if (er) {
40
+ t.fail(er)
41
+ return t.bailout()
42
+ }
43
+ fs.writeFile(f, "i like tests", function (er) {
44
+ t.ifError(er, "make file")
45
+ t.end()
46
+ })
47
+ })
48
+ })
49
+ })
50
+
51
+ if (process.platform !== "win32") {
52
+ tap.test("symlinky", function (t) {
53
+ var d = path.dirname(symlinkTo)
54
+ console.error("mkdirp", d)
55
+ mkdirp(d, 0755, function (er) {
56
+ t.ifError(er)
57
+ fs.symlink(symlinkFrom, symlinkTo, "dir", function (er) {
58
+ t.ifError(er, "make symlink")
59
+ t.end()
60
+ })
61
+ })
62
+ })
63
+ }
64
+
65
+ ;["foo","bar","baz","asdf","quux","qwer","rewq"].forEach(function (w) {
66
+ w = "/tmp/glob-test/" + w
67
+ tap.test("create " + w, function (t) {
68
+ mkdirp(w, function (er) {
69
+ if (er)
70
+ throw er
71
+ t.pass(w)
72
+ t.end()
73
+ })
74
+ })
75
+ })
76
+
77
+
78
+ // generate the bash pattern test-fixtures if possible
79
+ if (process.platform === "win32" || !process.env.TEST_REGEN) {
80
+ console.error("Windows, or TEST_REGEN unset. Using cached fixtures.")
81
+ return
82
+ }
83
+
84
+ var spawn = require("child_process").spawn;
85
+ var globs =
86
+ // put more patterns here.
87
+ // anything that would be directly in / should be in /tmp/glob-test
88
+ ["test/a/*/+(c|g)/./d"
89
+ ,"test/a/**/[cg]/../[cg]"
90
+ ,"test/a/{b,c,d,e,f}/**/g"
91
+ ,"test/a/b/**"
92
+ ,"test/**/g"
93
+ ,"test/a/abc{fed,def}/g/h"
94
+ ,"test/a/abc{fed/g,def}/**/"
95
+ ,"test/a/abc{fed/g,def}/**///**/"
96
+ ,"test/**/a/**/"
97
+ ,"test/+(a|b|c)/a{/,bc*}/**"
98
+ ,"test/*/*/*/f"
99
+ ,"test/**/f"
100
+ ,"test/a/symlink/a/b/c/a/b/c/a/b/c//a/b/c////a/b/c/**/b/c/**"
101
+ ,"{./*/*,/tmp/glob-test/*}"
102
+ ,"{/tmp/glob-test/*,*}" // evil owl face! how you taunt me!
103
+ ,"test/a/!(symlink)/**"
104
+ ]
105
+ var bashOutput = {}
106
+ var fs = require("fs")
107
+
108
+ globs.forEach(function (pattern) {
109
+ tap.test("generate fixture " + pattern, function (t) {
110
+ var cmd = "shopt -s globstar && " +
111
+ "shopt -s extglob && " +
112
+ "shopt -s nullglob && " +
113
+ // "shopt >&2; " +
114
+ "eval \'for i in " + pattern + "; do echo $i; done\'"
115
+ var cp = spawn("bash", ["-c", cmd], { cwd: path.dirname(__dirname) })
116
+ var out = []
117
+ cp.stdout.on("data", function (c) {
118
+ out.push(c)
119
+ })
120
+ cp.stderr.pipe(process.stderr)
121
+ cp.on("close", function (code) {
122
+ out = flatten(out)
123
+ if (!out)
124
+ out = []
125
+ else
126
+ out = cleanResults(out.split(/\r*\n/))
127
+
128
+ bashOutput[pattern] = out
129
+ t.notOk(code, "bash test should finish nicely")
130
+ t.end()
131
+ })
132
+ })
133
+ })
134
+
135
+ tap.test("save fixtures", function (t) {
136
+ var fname = path.resolve(__dirname, "bash-results.json")
137
+ var data = JSON.stringify(bashOutput, null, 2) + "\n"
138
+ fs.writeFile(fname, data, function (er) {
139
+ t.ifError(er)
140
+ t.end()
141
+ })
142
+ })
143
+
144
+ function cleanResults (m) {
145
+ // normalize discrepancies in ordering, duplication,
146
+ // and ending slashes.
147
+ return m.map(function (m) {
148
+ return m.replace(/\/+/g, "/").replace(/\/$/, "")
149
+ }).sort(alphasort).reduce(function (set, f) {
150
+ if (f !== set[set.length - 1]) set.push(f)
151
+ return set
152
+ }, []).sort(alphasort).map(function (f) {
153
+ // de-windows
154
+ return (process.platform !== 'win32') ? f
155
+ : f.replace(/^[a-zA-Z]:\\\\/, '/').replace(/\\/g, '/')
156
+ })
157
+ }
158
+
159
+ function flatten (chunks) {
160
+ var s = 0
161
+ chunks.forEach(function (c) { s += c.length })
162
+ var out = new Buffer(s)
163
+ s = 0
164
+ chunks.forEach(function (c) {
165
+ c.copy(out, s)
166
+ s += c.length
167
+ })
168
+
169
+ return out.toString().trim()
170
+ }
171
+
172
+ function alphasort (a, b) {
173
+ a = a.toLowerCase()
174
+ b = b.toLowerCase()
175
+ return a > b ? 1 : a < b ? -1 : 0
176
+ }
@@ -0,0 +1,63 @@
1
+ // basic test
2
+ // show that it does the same thing by default as the shell.
3
+ var tap = require("tap")
4
+ , child_process = require("child_process")
5
+ , bashResults = require("./bash-results.json")
6
+ , globs = Object.keys(bashResults)
7
+ , glob = require("../")
8
+ , path = require("path")
9
+
10
+ // run from the root of the project
11
+ // this is usually where you're at anyway, but be sure.
12
+ process.chdir(path.resolve(__dirname, ".."))
13
+
14
+ function alphasort (a, b) {
15
+ a = a.toLowerCase()
16
+ b = b.toLowerCase()
17
+ return a > b ? 1 : a < b ? -1 : 0
18
+ }
19
+
20
+ globs.forEach(function (pattern) {
21
+ var expect = bashResults[pattern]
22
+ // anything regarding the symlink thing will fail on windows, so just skip it
23
+ if (process.platform === "win32" &&
24
+ expect.some(function (m) {
25
+ return /\/symlink\//.test(m)
26
+ }))
27
+ return
28
+
29
+ tap.test(pattern, function (t) {
30
+ glob(pattern, function (er, matches) {
31
+ if (er)
32
+ throw er
33
+
34
+ // sort and unmark, just to match the shell results
35
+ matches = cleanResults(matches)
36
+
37
+ t.deepEqual(matches, expect, pattern)
38
+ t.end()
39
+ })
40
+ })
41
+
42
+ tap.test(pattern + " sync", function (t) {
43
+ var matches = cleanResults(glob.sync(pattern))
44
+
45
+ t.deepEqual(matches, expect, "should match shell")
46
+ t.end()
47
+ })
48
+ })
49
+
50
+ function cleanResults (m) {
51
+ // normalize discrepancies in ordering, duplication,
52
+ // and ending slashes.
53
+ return m.map(function (m) {
54
+ return m.replace(/\/+/g, "/").replace(/\/$/, "")
55
+ }).sort(alphasort).reduce(function (set, f) {
56
+ if (f !== set[set.length - 1]) set.push(f)
57
+ return set
58
+ }, []).sort(alphasort).map(function (f) {
59
+ // de-windows
60
+ return (process.platform !== 'win32') ? f
61
+ : f.replace(/^[a-zA-Z]:[\/\\]+/, '/').replace(/[\\\/]+/g, '/')
62
+ })
63
+ }