decidim 0.27.2 → 0.27.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of decidim might be problematic. Click here for more details.

Files changed (224) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +17 -10
  3. data/babel.config.json +1 -4
  4. data/docs/modules/customize/pages/data_consent.adoc +1 -1
  5. data/lib/decidim/release_manager.rb.new +43 -0
  6. data/lib/decidim/version.rb +1 -1
  7. data/package-lock.json +343 -255
  8. data/packages/browserslist-config/package.json +1 -1
  9. data/packages/core/node_modules/diff/CONTRIBUTING.md +39 -0
  10. data/packages/core/node_modules/diff/LICENSE +31 -0
  11. data/packages/core/node_modules/diff/README.md +211 -0
  12. data/packages/core/node_modules/diff/dist/diff.js +1627 -0
  13. data/packages/core/node_modules/diff/dist/diff.min.js +38 -0
  14. data/packages/core/node_modules/diff/lib/convert/dmp.js +32 -0
  15. data/packages/core/node_modules/diff/lib/convert/xml.js +42 -0
  16. data/packages/core/node_modules/diff/lib/diff/array.js +45 -0
  17. data/packages/core/node_modules/diff/lib/diff/base.js +307 -0
  18. data/packages/core/node_modules/diff/lib/diff/character.js +37 -0
  19. data/packages/core/node_modules/diff/lib/diff/css.js +41 -0
  20. data/packages/core/node_modules/diff/lib/diff/json.js +163 -0
  21. data/packages/core/node_modules/diff/lib/diff/line.js +89 -0
  22. data/packages/core/node_modules/diff/lib/diff/sentence.js +41 -0
  23. data/packages/core/node_modules/diff/lib/diff/word.js +108 -0
  24. data/packages/core/node_modules/diff/lib/index.es6.js +1561 -0
  25. data/packages/core/node_modules/diff/lib/index.js +216 -0
  26. data/packages/core/node_modules/diff/lib/index.mjs +1561 -0
  27. data/packages/core/node_modules/diff/lib/patch/apply.js +238 -0
  28. data/packages/core/node_modules/diff/lib/patch/create.js +272 -0
  29. data/packages/core/node_modules/diff/lib/patch/merge.js +613 -0
  30. data/packages/core/node_modules/diff/lib/patch/parse.js +167 -0
  31. data/packages/core/node_modules/diff/lib/util/array.js +32 -0
  32. data/packages/core/node_modules/diff/lib/util/distance-iterator.js +57 -0
  33. data/packages/core/node_modules/diff/lib/util/params.js +24 -0
  34. data/packages/core/node_modules/diff/package.json +87 -0
  35. data/packages/core/node_modules/diff/release-notes.md +309 -0
  36. data/packages/core/node_modules/diff/runtime.js +3 -0
  37. data/packages/core/package-lock.json +4889 -0
  38. data/packages/core/package.json +1 -1
  39. data/packages/dev/package.json +1 -1
  40. data/packages/elections/package.json +1 -1
  41. data/packages/eslint-config/package.json +1 -1
  42. data/packages/stylelint-config/package.json +1 -1
  43. data/packages/webpacker/node_modules/argparse/CHANGELOG.md +216 -0
  44. data/packages/webpacker/node_modules/argparse/LICENSE +254 -0
  45. data/packages/webpacker/node_modules/argparse/README.md +84 -0
  46. data/packages/webpacker/node_modules/argparse/argparse.js +3707 -0
  47. data/packages/webpacker/node_modules/argparse/lib/sub.js +67 -0
  48. data/packages/webpacker/node_modules/argparse/lib/textwrap.js +440 -0
  49. data/packages/webpacker/node_modules/argparse/package.json +31 -0
  50. data/packages/{core/node_modules/uuid/LICENSE.md → webpacker/node_modules/brace-expansion/LICENSE} +2 -2
  51. data/packages/webpacker/node_modules/brace-expansion/README.md +135 -0
  52. data/packages/webpacker/node_modules/brace-expansion/index.js +203 -0
  53. data/packages/webpacker/node_modules/brace-expansion/package.json +46 -0
  54. data/packages/webpacker/node_modules/glob/LICENSE +15 -0
  55. data/packages/webpacker/node_modules/glob/README.md +1214 -0
  56. data/packages/webpacker/node_modules/glob/dist/cjs/package.json +4 -0
  57. data/packages/webpacker/node_modules/glob/dist/cjs/src/bin.d.ts +3 -0
  58. data/packages/webpacker/node_modules/glob/dist/cjs/src/bin.d.ts.map +1 -0
  59. data/packages/webpacker/node_modules/glob/dist/cjs/src/bin.js +270 -0
  60. data/packages/webpacker/node_modules/glob/dist/cjs/src/bin.js.map +1 -0
  61. data/packages/webpacker/node_modules/glob/dist/cjs/src/glob.d.ts +344 -0
  62. data/packages/webpacker/node_modules/glob/dist/cjs/src/glob.d.ts.map +1 -0
  63. data/packages/webpacker/node_modules/glob/dist/cjs/src/glob.js +238 -0
  64. data/packages/webpacker/node_modules/glob/dist/cjs/src/glob.js.map +1 -0
  65. data/packages/webpacker/node_modules/glob/dist/cjs/src/has-magic.d.ts +14 -0
  66. data/packages/webpacker/node_modules/glob/dist/cjs/src/has-magic.d.ts.map +1 -0
  67. data/packages/webpacker/node_modules/glob/dist/cjs/src/has-magic.js +27 -0
  68. data/packages/webpacker/node_modules/glob/dist/cjs/src/has-magic.js.map +1 -0
  69. data/packages/webpacker/node_modules/glob/dist/cjs/src/ignore.d.ts +20 -0
  70. data/packages/webpacker/node_modules/glob/dist/cjs/src/ignore.d.ts.map +1 -0
  71. data/packages/webpacker/node_modules/glob/dist/cjs/src/ignore.js +103 -0
  72. data/packages/webpacker/node_modules/glob/dist/cjs/src/ignore.js.map +1 -0
  73. data/packages/webpacker/node_modules/glob/dist/cjs/src/index.d.ts +95 -0
  74. data/packages/webpacker/node_modules/glob/dist/cjs/src/index.d.ts.map +1 -0
  75. data/packages/webpacker/node_modules/glob/dist/cjs/src/index.js +68 -0
  76. data/packages/webpacker/node_modules/glob/dist/cjs/src/index.js.map +1 -0
  77. data/packages/webpacker/node_modules/glob/dist/cjs/src/pattern.d.ts +77 -0
  78. data/packages/webpacker/node_modules/glob/dist/cjs/src/pattern.d.ts.map +1 -0
  79. data/packages/webpacker/node_modules/glob/dist/cjs/src/pattern.js +219 -0
  80. data/packages/webpacker/node_modules/glob/dist/cjs/src/pattern.js.map +1 -0
  81. data/packages/webpacker/node_modules/glob/dist/cjs/src/processor.d.ts +59 -0
  82. data/packages/webpacker/node_modules/glob/dist/cjs/src/processor.d.ts.map +1 -0
  83. data/packages/webpacker/node_modules/glob/dist/cjs/src/processor.js +309 -0
  84. data/packages/webpacker/node_modules/glob/dist/cjs/src/processor.js.map +1 -0
  85. data/packages/webpacker/node_modules/glob/dist/cjs/src/walker.d.ts +96 -0
  86. data/packages/webpacker/node_modules/glob/dist/cjs/src/walker.d.ts.map +1 -0
  87. data/packages/webpacker/node_modules/glob/dist/cjs/src/walker.js +358 -0
  88. data/packages/webpacker/node_modules/glob/dist/cjs/src/walker.js.map +1 -0
  89. data/packages/webpacker/node_modules/glob/dist/mjs/glob.d.ts +344 -0
  90. data/packages/webpacker/node_modules/glob/dist/mjs/glob.d.ts.map +1 -0
  91. data/packages/webpacker/node_modules/glob/dist/mjs/glob.js +234 -0
  92. data/packages/webpacker/node_modules/glob/dist/mjs/glob.js.map +1 -0
  93. data/packages/webpacker/node_modules/glob/dist/mjs/has-magic.d.ts +14 -0
  94. data/packages/webpacker/node_modules/glob/dist/mjs/has-magic.d.ts.map +1 -0
  95. data/packages/webpacker/node_modules/glob/dist/mjs/has-magic.js +23 -0
  96. data/packages/webpacker/node_modules/glob/dist/mjs/has-magic.js.map +1 -0
  97. data/packages/webpacker/node_modules/glob/dist/mjs/ignore.d.ts +20 -0
  98. data/packages/webpacker/node_modules/glob/dist/mjs/ignore.d.ts.map +1 -0
  99. data/packages/webpacker/node_modules/glob/dist/mjs/ignore.js +99 -0
  100. data/packages/webpacker/node_modules/glob/dist/mjs/ignore.js.map +1 -0
  101. data/packages/webpacker/node_modules/glob/dist/mjs/index.d.ts +95 -0
  102. data/packages/webpacker/node_modules/glob/dist/mjs/index.d.ts.map +1 -0
  103. data/packages/webpacker/node_modules/glob/dist/mjs/index.js +56 -0
  104. data/packages/webpacker/node_modules/glob/dist/mjs/index.js.map +1 -0
  105. data/packages/webpacker/node_modules/glob/dist/mjs/package.json +4 -0
  106. data/packages/webpacker/node_modules/glob/dist/mjs/pattern.d.ts +77 -0
  107. data/packages/webpacker/node_modules/glob/dist/mjs/pattern.d.ts.map +1 -0
  108. data/packages/webpacker/node_modules/glob/dist/mjs/pattern.js +215 -0
  109. data/packages/webpacker/node_modules/glob/dist/mjs/pattern.js.map +1 -0
  110. data/packages/webpacker/node_modules/glob/dist/mjs/processor.d.ts +59 -0
  111. data/packages/webpacker/node_modules/glob/dist/mjs/processor.d.ts.map +1 -0
  112. data/packages/webpacker/node_modules/glob/dist/mjs/processor.js +302 -0
  113. data/packages/webpacker/node_modules/glob/dist/mjs/processor.js.map +1 -0
  114. data/packages/webpacker/node_modules/glob/dist/mjs/walker.d.ts +96 -0
  115. data/packages/webpacker/node_modules/glob/dist/mjs/walker.d.ts.map +1 -0
  116. data/packages/webpacker/node_modules/glob/dist/mjs/walker.js +352 -0
  117. data/packages/webpacker/node_modules/glob/dist/mjs/walker.js.map +1 -0
  118. data/packages/webpacker/node_modules/glob/package.json +98 -0
  119. data/packages/webpacker/node_modules/js-yaml/CHANGELOG.md +616 -0
  120. data/packages/webpacker/node_modules/js-yaml/LICENSE +21 -0
  121. data/packages/webpacker/node_modules/js-yaml/README.md +246 -0
  122. data/packages/webpacker/node_modules/js-yaml/bin/js-yaml.js +126 -0
  123. data/packages/webpacker/node_modules/js-yaml/dist/js-yaml.js +3874 -0
  124. data/packages/webpacker/node_modules/js-yaml/dist/js-yaml.min.js +2 -0
  125. data/packages/webpacker/node_modules/js-yaml/dist/js-yaml.mjs +3851 -0
  126. data/packages/webpacker/node_modules/js-yaml/index.js +47 -0
  127. data/packages/webpacker/node_modules/js-yaml/lib/common.js +59 -0
  128. data/packages/webpacker/node_modules/js-yaml/lib/dumper.js +965 -0
  129. data/packages/webpacker/node_modules/js-yaml/lib/exception.js +55 -0
  130. data/packages/webpacker/node_modules/js-yaml/lib/loader.js +1727 -0
  131. data/packages/webpacker/node_modules/js-yaml/lib/schema/core.js +11 -0
  132. data/packages/webpacker/node_modules/js-yaml/lib/schema/default.js +22 -0
  133. data/packages/webpacker/node_modules/js-yaml/lib/schema/failsafe.js +17 -0
  134. data/packages/webpacker/node_modules/js-yaml/lib/schema/json.js +19 -0
  135. data/packages/webpacker/node_modules/js-yaml/lib/schema.js +121 -0
  136. data/packages/webpacker/node_modules/js-yaml/lib/snippet.js +101 -0
  137. data/packages/webpacker/node_modules/js-yaml/lib/type/binary.js +125 -0
  138. data/packages/webpacker/node_modules/js-yaml/lib/type/bool.js +35 -0
  139. data/packages/webpacker/node_modules/js-yaml/lib/type/float.js +97 -0
  140. data/packages/webpacker/node_modules/js-yaml/lib/type/int.js +156 -0
  141. data/packages/webpacker/node_modules/js-yaml/lib/type/map.js +8 -0
  142. data/packages/webpacker/node_modules/js-yaml/lib/type/merge.js +12 -0
  143. data/packages/webpacker/node_modules/js-yaml/lib/type/null.js +35 -0
  144. data/packages/webpacker/node_modules/js-yaml/lib/type/omap.js +44 -0
  145. data/packages/webpacker/node_modules/js-yaml/lib/type/pairs.js +53 -0
  146. data/packages/webpacker/node_modules/js-yaml/lib/type/seq.js +8 -0
  147. data/packages/webpacker/node_modules/js-yaml/lib/type/set.js +29 -0
  148. data/packages/webpacker/node_modules/js-yaml/lib/type/str.js +8 -0
  149. data/packages/webpacker/node_modules/js-yaml/lib/type/timestamp.js +88 -0
  150. data/packages/webpacker/node_modules/js-yaml/lib/type.js +66 -0
  151. data/packages/webpacker/node_modules/js-yaml/package.json +66 -0
  152. data/packages/webpacker/node_modules/minimatch/LICENSE +15 -0
  153. data/packages/webpacker/node_modules/minimatch/README.md +454 -0
  154. data/packages/webpacker/node_modules/minimatch/dist/cjs/assert-valid-pattern.d.ts +2 -0
  155. data/packages/webpacker/node_modules/minimatch/dist/cjs/assert-valid-pattern.d.ts.map +1 -0
  156. data/packages/webpacker/node_modules/minimatch/dist/cjs/assert-valid-pattern.js +14 -0
  157. data/packages/webpacker/node_modules/minimatch/dist/cjs/assert-valid-pattern.js.map +1 -0
  158. data/packages/webpacker/node_modules/minimatch/dist/cjs/ast.d.ts +19 -0
  159. data/packages/webpacker/node_modules/minimatch/dist/cjs/ast.d.ts.map +1 -0
  160. data/packages/webpacker/node_modules/minimatch/dist/cjs/ast.js +589 -0
  161. data/packages/webpacker/node_modules/minimatch/dist/cjs/ast.js.map +1 -0
  162. data/packages/webpacker/node_modules/minimatch/dist/cjs/brace-expressions.d.ts +8 -0
  163. data/packages/webpacker/node_modules/minimatch/dist/cjs/brace-expressions.d.ts.map +1 -0
  164. data/packages/webpacker/node_modules/minimatch/dist/cjs/brace-expressions.js +152 -0
  165. data/packages/webpacker/node_modules/minimatch/dist/cjs/brace-expressions.js.map +1 -0
  166. data/packages/webpacker/node_modules/minimatch/dist/cjs/escape.d.ts +12 -0
  167. data/packages/webpacker/node_modules/minimatch/dist/cjs/escape.d.ts.map +1 -0
  168. data/packages/webpacker/node_modules/minimatch/dist/cjs/escape.js +22 -0
  169. data/packages/webpacker/node_modules/minimatch/dist/cjs/escape.js.map +1 -0
  170. data/packages/webpacker/node_modules/minimatch/dist/cjs/index.d.ts +94 -0
  171. data/packages/webpacker/node_modules/minimatch/dist/cjs/index.d.ts.map +1 -0
  172. data/packages/webpacker/node_modules/minimatch/dist/cjs/index.js +1011 -0
  173. data/packages/webpacker/node_modules/minimatch/dist/cjs/index.js.map +1 -0
  174. data/packages/webpacker/node_modules/minimatch/dist/cjs/package.json +3 -0
  175. data/packages/webpacker/node_modules/minimatch/dist/cjs/unescape.d.ts +17 -0
  176. data/packages/webpacker/node_modules/minimatch/dist/cjs/unescape.d.ts.map +1 -0
  177. data/packages/webpacker/node_modules/minimatch/dist/cjs/unescape.js +24 -0
  178. data/packages/webpacker/node_modules/minimatch/dist/cjs/unescape.js.map +1 -0
  179. data/packages/webpacker/node_modules/minimatch/dist/mjs/assert-valid-pattern.d.ts +2 -0
  180. data/packages/webpacker/node_modules/minimatch/dist/mjs/assert-valid-pattern.d.ts.map +1 -0
  181. data/packages/webpacker/node_modules/minimatch/dist/mjs/assert-valid-pattern.js +10 -0
  182. data/packages/webpacker/node_modules/minimatch/dist/mjs/assert-valid-pattern.js.map +1 -0
  183. data/packages/webpacker/node_modules/minimatch/dist/mjs/ast.d.ts +19 -0
  184. data/packages/webpacker/node_modules/minimatch/dist/mjs/ast.d.ts.map +1 -0
  185. data/packages/webpacker/node_modules/minimatch/dist/mjs/ast.js +585 -0
  186. data/packages/webpacker/node_modules/minimatch/dist/mjs/ast.js.map +1 -0
  187. data/packages/webpacker/node_modules/minimatch/dist/mjs/brace-expressions.d.ts +8 -0
  188. data/packages/webpacker/node_modules/minimatch/dist/mjs/brace-expressions.d.ts.map +1 -0
  189. data/packages/webpacker/node_modules/minimatch/dist/mjs/brace-expressions.js +148 -0
  190. data/packages/webpacker/node_modules/minimatch/dist/mjs/brace-expressions.js.map +1 -0
  191. data/packages/webpacker/node_modules/minimatch/dist/mjs/escape.d.ts +12 -0
  192. data/packages/webpacker/node_modules/minimatch/dist/mjs/escape.d.ts.map +1 -0
  193. data/packages/webpacker/node_modules/minimatch/dist/mjs/escape.js +18 -0
  194. data/packages/webpacker/node_modules/minimatch/dist/mjs/escape.js.map +1 -0
  195. data/packages/webpacker/node_modules/minimatch/dist/mjs/index.d.ts +94 -0
  196. data/packages/webpacker/node_modules/minimatch/dist/mjs/index.d.ts.map +1 -0
  197. data/packages/webpacker/node_modules/minimatch/dist/mjs/index.js +995 -0
  198. data/packages/webpacker/node_modules/minimatch/dist/mjs/index.js.map +1 -0
  199. data/packages/webpacker/node_modules/minimatch/dist/mjs/package.json +3 -0
  200. data/packages/webpacker/node_modules/minimatch/dist/mjs/unescape.d.ts +17 -0
  201. data/packages/webpacker/node_modules/minimatch/dist/mjs/unescape.d.ts.map +1 -0
  202. data/packages/webpacker/node_modules/minimatch/dist/mjs/unescape.js +20 -0
  203. data/packages/webpacker/node_modules/minimatch/dist/mjs/unescape.js.map +1 -0
  204. data/packages/webpacker/node_modules/minimatch/package.json +86 -0
  205. data/packages/webpacker/package.json +2 -2
  206. metadata +238 -65
  207. data/packages/core/node_modules/uuid/AUTHORS +0 -5
  208. data/packages/core/node_modules/uuid/CHANGELOG.md +0 -119
  209. data/packages/core/node_modules/uuid/README.md +0 -276
  210. data/packages/core/node_modules/uuid/bin/uuid +0 -65
  211. data/packages/core/node_modules/uuid/index.js +0 -8
  212. data/packages/core/node_modules/uuid/lib/bytesToUuid.js +0 -26
  213. data/packages/core/node_modules/uuid/lib/md5-browser.js +0 -216
  214. data/packages/core/node_modules/uuid/lib/md5.js +0 -25
  215. data/packages/core/node_modules/uuid/lib/rng-browser.js +0 -34
  216. data/packages/core/node_modules/uuid/lib/rng.js +0 -8
  217. data/packages/core/node_modules/uuid/lib/sha1-browser.js +0 -89
  218. data/packages/core/node_modules/uuid/lib/sha1.js +0 -25
  219. data/packages/core/node_modules/uuid/lib/v35.js +0 -57
  220. data/packages/core/node_modules/uuid/package.json +0 -49
  221. data/packages/core/node_modules/uuid/v1.js +0 -109
  222. data/packages/core/node_modules/uuid/v3.js +0 -4
  223. data/packages/core/node_modules/uuid/v4.js +0 -29
  224. data/packages/core/node_modules/uuid/v5.js +0 -3
@@ -0,0 +1,1214 @@
1
+ # Glob
2
+
3
+ Match files using the patterns the shell uses.
4
+
5
+ The most correct and second fastest glob implementation in
6
+ JavaScript. (See **Comparison to Other JavaScript Glob
7
+ Implementations** at the bottom of this readme.)
8
+
9
+ ![a fun cartoon logo made of glob characters](https://github.com/isaacs/node-glob/raw/main/logo/glob.png)
10
+
11
+ ## Usage
12
+
13
+ Install with npm
14
+
15
+ ```
16
+ npm i glob
17
+ ```
18
+
19
+ **Note** the npm package name is _not_ `node-glob` that's a
20
+ different thing that was abandoned years ago. Just `glob`.
21
+
22
+ ```js
23
+ // load using import
24
+ import { glob, globSync, globStream, globStreamSync, Glob } from 'glob'
25
+ // or using commonjs, that's fine, too
26
+ const {
27
+ glob,
28
+ globSync,
29
+ globStream,
30
+ globStreamSync,
31
+ Glob,
32
+ } = require('glob')
33
+
34
+ // the main glob() and globSync() resolve/return array of filenames
35
+
36
+ // all js files, but don't look in node_modules
37
+ const jsfiles = await glob('**/*.js', { ignore: 'node_modules/**' })
38
+
39
+ // pass in a signal to cancel the glob walk
40
+ const stopAfter100ms = await glob('**/*.css', {
41
+ signal: AbortSignal.timeout(100),
42
+ })
43
+
44
+ // multiple patterns supported as well
45
+ const images = await glob(['css/*.{png,jpeg}', 'public/*.{png,jpeg}'])
46
+
47
+ // but of course you can do that with the glob pattern also
48
+ // the sync function is the same, just returns a string[] instead
49
+ // of Promise<string[]>
50
+ const imagesAlt = globSync('{css,public}/*.{png,jpeg}')
51
+
52
+ // you can also stream them, this is a Minipass stream
53
+ const filesStream = globStream(['**/*.dat', 'logs/**/*.log'])
54
+
55
+ // construct a Glob object if you wanna do it that way, which
56
+ // allows for much faster walks if you have to look in the same
57
+ // folder multiple times.
58
+ const g = new Glob('**/foo', {})
59
+ // glob objects are async iterators, can also do globIterate() or
60
+ // g.iterate(), same deal
61
+ for await (const file of g) {
62
+ console.log('found a foo file:', file)
63
+ }
64
+ // pass a glob as the glob options to reuse its settings and caches
65
+ const g2 = new Glob('**/bar', g)
66
+ // sync iteration works as well
67
+ for (const file of g2) {
68
+ console.log('found a bar file:', file)
69
+ }
70
+
71
+ // you can also pass withFileTypes: true to get Path objects
72
+ // these are like a Dirent, but with some more added powers
73
+ // check out http://npm.im/path-scurry for more info on their API
74
+ const g3 = new Glob('**/baz/**', { withFileTypes: true })
75
+ g3.stream().on('data', path => {
76
+ console.log(
77
+ 'got a path object',
78
+ path.fullpath(),
79
+ path.isDirectory(),
80
+ path.readdirSync().map(e => e.name)
81
+ )
82
+ })
83
+
84
+ // if you use stat:true and withFileTypes, you can sort results
85
+ // by things like modified time, filter by permission mode, etc.
86
+ // All Stats fields will be available in that case. Slightly
87
+ // slower, though.
88
+ // For example:
89
+ const results = await glob('**', { stat: true, withFileTypes: true })
90
+
91
+ const timeSortedFiles = results
92
+ .sort((a, b) => a.mtimeMS - b.mtimeMS)
93
+ .map(path => path.fullpath())
94
+
95
+ const groupReadableFiles = results
96
+ .filter(path => path.mode & 0o040)
97
+ .map(path => path.fullpath())
98
+
99
+ // custom ignores can be done like this, for example by saying
100
+ // you'll ignore all markdown files, and all folders named 'docs'
101
+ const customIgnoreResults = await glob('**', {
102
+ ignore: {
103
+ ignored: p => /\.md$/.test(p.name),
104
+ childrenIgnored: p => p.isNamed('docs'),
105
+ },
106
+ })
107
+
108
+ // another fun use case, only return files with the same name as
109
+ // their parent folder, plus either `.ts` or `.js`
110
+ const folderNamedModules = await glob('**/*.{ts,js}', {
111
+ ignore: {
112
+ ignored: p => {
113
+ const pp = p.parent
114
+ return !(p.isNamed(pp.name + '.ts') || p.isNamed(pp.name + '.js'))
115
+ },
116
+ },
117
+ })
118
+
119
+ // find all files edited in the last hour, to do this, we ignore
120
+ // all of them that are more than an hour old
121
+ const newFiles = await glob('**', {
122
+ // need stat so we have mtime
123
+ stat: true,
124
+ // only want the files, not the dirs
125
+ nodir: true,
126
+ ignore: {
127
+ ignored: p => {
128
+ return new Date() - p.mtime > 60 * 60 * 1000
129
+ },
130
+ // could add similar childrenIgnored here as well, but
131
+ // directory mtime is inconsistent across platforms, so
132
+ // probably better not to, unless you know the system
133
+ // tracks this reliably.
134
+ },
135
+ })
136
+ ```
137
+
138
+ **Note** Glob patterns should always use `/` as a path separator,
139
+ even on Windows systems, as `\` is used to escape glob
140
+ characters. If you wish to use `\` as a path separator _instead
141
+ of_ using it as an escape character on Windows platforms, you may
142
+ set `windowsPathsNoEscape:true` in the options. In this mode,
143
+ special glob characters cannot be escaped, making it impossible
144
+ to match a literal `*` `?` and so on in filenames.
145
+
146
+ ## Command Line Interface
147
+
148
+ ```
149
+ $ glob -h
150
+
151
+ Usage:
152
+ glob [options] [<pattern> [<pattern> ...]]
153
+
154
+ Expand the positional glob expression arguments into any matching file system
155
+ paths found.
156
+
157
+ -c<command> --cmd=<command>
158
+ Run the command provided, passing the glob expression
159
+ matches as arguments.
160
+
161
+ -A --all By default, the glob cli command will not expand any
162
+ arguments that are an exact match to a file on disk.
163
+
164
+ This prevents double-expanding, in case the shell
165
+ expands an argument whose filename is a glob
166
+ expression.
167
+
168
+ For example, if 'app/*.ts' would match 'app/[id].ts',
169
+ then on Windows powershell or cmd.exe, 'glob app/*.ts'
170
+ will expand to 'app/[id].ts', as expected. However, in
171
+ posix shells such as bash or zsh, the shell will first
172
+ expand 'app/*.ts' to a list of filenames. Then glob
173
+ will look for a file matching 'app/[id].ts' (ie,
174
+ 'app/i.ts' or 'app/d.ts'), which is unexpected.
175
+
176
+ Setting '--all' prevents this behavior, causing glob to
177
+ treat ALL patterns as glob expressions to be expanded,
178
+ even if they are an exact match to a file on disk.
179
+
180
+ When setting this option, be sure to enquote arguments
181
+ so that the shell will not expand them prior to passing
182
+ them to the glob command process.
183
+
184
+ -a --absolute Expand to absolute paths
185
+ -d --dot-relative Prepend './' on relative matches
186
+ -m --mark Append a / on any directories matched
187
+ -x --posix Always resolve to posix style paths, using '/' as the
188
+ directory separator, even on Windows. Drive letter
189
+ absolute matches on Windows will be expanded to their
190
+ full resolved UNC maths, eg instead of 'C:\foo\bar', it
191
+ will expand to '//?/C:/foo/bar'.
192
+
193
+ -f --follow Follow symlinked directories when expanding '**'
194
+ -R --realpath Call 'fs.realpath' on all of the results. In the case
195
+ of an entry that cannot be resolved, the entry is
196
+ omitted. This incurs a slight performance penalty, of
197
+ course, because of the added system calls.
198
+
199
+ -s --stat Call 'fs.lstat' on all entries, whether required or not
200
+ to determine if it's a valid match.
201
+
202
+ -b --match-base Perform a basename-only match if the pattern does not
203
+ contain any slash characters. That is, '*.js' would be
204
+ treated as equivalent to '**/*.js', matching js files
205
+ in all directories.
206
+
207
+ --dot Allow patterns to match files/directories that start
208
+ with '.', even if the pattern does not start with '.'
209
+
210
+ --nobrace Do not expand {...} patterns
211
+ --nocase Perform a case-insensitive match. This defaults to
212
+ 'true' on macOS and Windows platforms, and false on all
213
+ others.
214
+
215
+ Note: 'nocase' should only be explicitly set when it is
216
+ known that the filesystem's case sensitivity differs
217
+ from the platform default. If set 'true' on
218
+ case-insensitive file systems, then the walk may return
219
+ more or less results than expected.
220
+
221
+ --nodir Do not match directories, only files.
222
+
223
+ Note: to *only* match directories, append a '/' at the
224
+ end of the pattern.
225
+
226
+ --noext Do not expand extglob patterns, such as '+(a|b)'
227
+ --noglobstar Do not expand '**' against multiple path portions. Ie,
228
+ treat it as a normal '*' instead.
229
+
230
+ --windows-path-no-escape
231
+ Use '\' as a path separator *only*, and *never* as an
232
+ escape character. If set, all '\' characters are
233
+ replaced with '/' in the pattern.
234
+
235
+ -D<n> --max-depth=<n> Maximum depth to traverse from the current working
236
+ directory
237
+
238
+ -C<cwd> --cwd=<cwd> Current working directory to execute/match in
239
+ -r<root> --root=<root> A string path resolved against the 'cwd', which is used
240
+ as the starting point for absolute patterns that start
241
+ with '/' (but not drive letters or UNC paths on
242
+ Windows).
243
+
244
+ Note that this *doesn't* necessarily limit the walk to
245
+ the 'root' directory, and doesn't affect the cwd
246
+ starting point for non-absolute patterns. A pattern
247
+ containing '..' will still be able to traverse out of
248
+ the root directory, if it is not an actual root
249
+ directory on the filesystem, and any non-absolute
250
+ patterns will still be matched in the 'cwd'.
251
+
252
+ To start absolute and non-absolute patterns in the same
253
+ path, you can use '--root=' to set it to the empty
254
+ string. However, be aware that on Windows systems, a
255
+ pattern like 'x:/*' or '//host/share/*' will *always*
256
+ start in the 'x:/' or '//host/share/' directory,
257
+ regardless of the --root setting.
258
+
259
+ --platform=<platform> Defaults to the value of 'process.platform' if
260
+ available, or 'linux' if not. Setting --platform=win32
261
+ on non-Windows systems may cause strange behavior!
262
+
263
+ -i<ignore> --ignore=<ignore>
264
+ Glob patterns to ignore Can be set multiple times
265
+ -v --debug Output a huge amount of noisy debug information about
266
+ patterns as they are parsed and used to match files.
267
+
268
+ -h --help Show this usage information
269
+ ```
270
+
271
+ ## `glob(pattern: string | string[], options?: GlobOptions) => Promise<string[] | Path[]>`
272
+
273
+ Perform an asynchronous glob search for the pattern(s) specified.
274
+ Returns
275
+ [Path](https://isaacs.github.io/path-scurry/classes/PathBase)
276
+ objects if the `withFileTypes` option is set to `true`. See below
277
+ for full options field desciptions.
278
+
279
+ ## `globSync(pattern: string | string[], options?: GlobOptions) => string[] | Path[]`
280
+
281
+ Synchronous form of `glob()`.
282
+
283
+ Alias: `glob.sync()`
284
+
285
+ ## `globIterate(pattern: string | string[], options?: GlobOptions) => AsyncGenerator<string>`
286
+
287
+ Return an async iterator for walking glob pattern matches.
288
+
289
+ Alias: `glob.iterate()`
290
+
291
+ ## `globIterateSync(pattern: string | string[], options?: GlobOptions) => Generator<string>`
292
+
293
+ Return a sync iterator for walking glob pattern matches.
294
+
295
+ Alias: `glob.iterate.sync()`, `glob.sync.iterate()`
296
+
297
+ ## `globStream(pattern: string | string[], options?: GlobOptions) => Minipass<string | Path>`
298
+
299
+ Return a stream that emits all the strings or `Path` objects and
300
+ then emits `end` when completed.
301
+
302
+ Alias: `glob.stream()`
303
+
304
+ ## `globStreamSync(pattern: string | string[], options?: GlobOptions) => Minipass<string | Path>`
305
+
306
+ Syncronous form of `globStream()`. Will read all the matches as
307
+ fast as you consume them, even all in a single tick if you
308
+ consume them immediately, but will still respond to backpressure
309
+ if they're not consumed immediately.
310
+
311
+ Alias: `glob.stream.sync()`, `glob.sync.stream()`
312
+
313
+ ## `hasMagic(pattern: string | string[], options?: GlobOptions) => boolean`
314
+
315
+ Returns `true` if the provided pattern contains any "magic" glob
316
+ characters, given the options provided.
317
+
318
+ Brace expansion is not considered "magic" unless the
319
+ `magicalBraces` option is set, as brace expansion just turns one
320
+ string into an array of strings. So a pattern like `'x{a,b}y'`
321
+ would return `false`, because `'xay'` and `'xby'` both do not
322
+ contain any magic glob characters, and it's treated the same as
323
+ if you had called it on `['xay', 'xby']`. When
324
+ `magicalBraces:true` is in the options, brace expansion _is_
325
+ treated as a pattern having magic.
326
+
327
+ ## `escape(pattern: string, options?: GlobOptions) => string`
328
+
329
+ Escape all magic characters in a glob pattern, so that it will
330
+ only ever match literal strings
331
+
332
+ If the `windowsPathsNoEscape` option is used, then characters are
333
+ escaped by wrapping in `[]`, because a magic character wrapped in
334
+ a character class can only be satisfied by that exact character.
335
+
336
+ Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot
337
+ be escaped or unescaped.
338
+
339
+ ## `unescape(pattern: string, options?: GlobOptions) => string`
340
+
341
+ Un-escape a glob string that may contain some escaped characters.
342
+
343
+ If the `windowsPathsNoEscape` option is used, then square-brace
344
+ escapes are removed, but not backslash escapes. For example, it
345
+ will turn the string `'[*]'` into `*`, but it will not turn
346
+ `'\\*'` into `'*'`, because `\` is a path separator in
347
+ `windowsPathsNoEscape` mode.
348
+
349
+ When `windowsPathsNoEscape` is not set, then both brace escapes
350
+ and backslash escapes are removed.
351
+
352
+ Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot
353
+ be escaped or unescaped.
354
+
355
+ ## Class `Glob`
356
+
357
+ An object that can perform glob pattern traversals.
358
+
359
+ ### `const g = new Glob(pattern: string | string[], options: GlobOptions)`
360
+
361
+ Options object is required.
362
+
363
+ See full options descriptions below.
364
+
365
+ Note that a previous `Glob` object can be passed as the
366
+ `GlobOptions` to another `Glob` instantiation to re-use settings
367
+ and caches with a new pattern.
368
+
369
+ Traversal functions can be called multiple times to run the walk
370
+ again.
371
+
372
+ ### `g.stream()`
373
+
374
+ Stream results asynchronously,
375
+
376
+ ### `g.streamSync()`
377
+
378
+ Stream results synchronously.
379
+
380
+ ### `g.iterate()`
381
+
382
+ Default async iteration function. Returns an AsyncGenerator that
383
+ iterates over the results.
384
+
385
+ ### `g.iterateSync()`
386
+
387
+ Default sync iteration function. Returns a Generator that
388
+ iterates over the results.
389
+
390
+ ### `g.walk()`
391
+
392
+ Returns a Promise that resolves to the results array.
393
+
394
+ ### `g.walkSync()`
395
+
396
+ Returns a results array.
397
+
398
+ ### Properties
399
+
400
+ All options are stored as properties on the `Glob` object.
401
+
402
+ - `opts` The options provided to the constructor.
403
+ - `patterns` An array of parsed immutable `Pattern` objects.
404
+
405
+ ## Options
406
+
407
+ Exported as `GlobOptions` TypeScript interface. A `GlobOptions`
408
+ object may be provided to any of the exported methods, and must
409
+ be provided to the `Glob` constructor.
410
+
411
+ All options are optional, boolean, and false by default, unless
412
+ otherwise noted.
413
+
414
+ All resolved options are added to the Glob object as properties.
415
+
416
+ If you are running many `glob` operations, you can pass a Glob
417
+ object as the `options` argument to a subsequent operation to
418
+ share the previously loaded cache.
419
+
420
+ - `cwd` String path or `file://` string or URL object. The
421
+ current working directory in which to search. Defaults to
422
+ `process.cwd()`. See also: "Windows, CWDs, Drive Letters, and
423
+ UNC Paths", below.
424
+
425
+ This option may be eiher a string path or a `file://` URL
426
+ object or string.
427
+
428
+ - `root` A string path resolved against the `cwd` option, which
429
+ is used as the starting point for absolute patterns that start
430
+ with `/`, (but not drive letters or UNC paths on Windows).
431
+
432
+ Note that this _doesn't_ necessarily limit the walk to the
433
+ `root` directory, and doesn't affect the cwd starting point for
434
+ non-absolute patterns. A pattern containing `..` will still be
435
+ able to traverse out of the root directory, if it is not an
436
+ actual root directory on the filesystem, and any non-absolute
437
+ patterns will be matched in the `cwd`. For example, the
438
+ pattern `/../*` with `{root:'/some/path'}` will return all
439
+ files in `/some`, not all files in `/some/path`. The pattern
440
+ `*` with `{root:'/some/path'}` will return all the entries in
441
+ the cwd, not the entries in `/some/path`.
442
+
443
+ To start absolute and non-absolute patterns in the same
444
+ path, you can use `{root:''}`. However, be aware that on
445
+ Windows systems, a pattern like `x:/*` or `//host/share/*` will
446
+ _always_ start in the `x:/` or `//host/share` directory,
447
+ regardless of the `root` setting.
448
+
449
+ - `windowsPathsNoEscape` Use `\\` as a path separator _only_, and
450
+ _never_ as an escape character. If set, all `\\` characters are
451
+ replaced with `/` in the pattern.
452
+
453
+ Note that this makes it **impossible** to match against paths
454
+ containing literal glob pattern characters, but allows matching
455
+ with patterns constructed using `path.join()` and
456
+ `path.resolve()` on Windows platforms, mimicking the (buggy!)
457
+ behavior of Glob v7 and before on Windows. Please use with
458
+ caution, and be mindful of [the caveat below about Windows
459
+ paths](#windows). (For legacy reasons, this is also set if
460
+ `allowWindowsEscape` is set to the exact value `false`.)
461
+
462
+ - `dot` Include `.dot` files in normal matches and `globstar`
463
+ matches. Note that an explicit dot in a portion of the pattern
464
+ will always match dot files.
465
+
466
+ - `magicalBraces` Treat brace expansion like `{a,b}` as a "magic"
467
+ pattern. Has no effect if {@link nobrace} is set.
468
+
469
+ Only has effect on the {@link hasMagic} function, no effect on
470
+ glob pattern matching itself.
471
+
472
+ - `dotRelative` Prepend all relative path strings with `./` (or
473
+ `.\` on Windows).
474
+
475
+ Without this option, returned relative paths are "bare", so
476
+ instead of returning `'./foo/bar'`, they are returned as
477
+ `'foo/bar'`.
478
+
479
+ Relative patterns starting with `'../'` are not prepended with
480
+ `./`, even if this option is set.
481
+
482
+ - `mark` Add a `/` character to directory matches. Note that this
483
+ requires additional stat calls.
484
+
485
+ - `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets.
486
+
487
+ - `noglobstar` Do not match `**` against multiple filenames. (Ie,
488
+ treat it as a normal `*` instead.)
489
+
490
+ - `noext` Do not match "extglob" patterns such as `+(a|b)`.
491
+
492
+ - `nocase` Perform a case-insensitive match. This defaults to
493
+ `true` on macOS and Windows systems, and `false` on all others.
494
+
495
+ **Note** `nocase` should only be explicitly set when it is
496
+ known that the filesystem's case sensitivity differs from the
497
+ platform default. If set `true` on case-sensitive file
498
+ systems, or `false` on case-insensitive file systems, then the
499
+ walk may return more or less results than expected.
500
+
501
+ - `maxDepth` Specify a number to limit the depth of the directory
502
+ traversal to this many levels below the `cwd`.
503
+
504
+ - `matchBase` Perform a basename-only match if the pattern does
505
+ not contain any slash characters. That is, `*.js` would be
506
+ treated as equivalent to `**/*.js`, matching all js files in
507
+ all directories.
508
+
509
+ - `nodir` Do not match directories, only files. (Note: to match
510
+ _only_ directories, put a `/` at the end of the pattern.)
511
+
512
+ - `stat` Call `lstat()` on all entries, whether required or not
513
+ to determine whether it's a valid match. When used with
514
+ `withFileTypes`, this means that matches will include data such
515
+ as modified time, permissions, and so on. Note that this will
516
+ incur a performance cost due to the added system calls.
517
+
518
+ - `ignore` string or string[], or an object with `ignore` and
519
+ `ignoreChildren` methods.
520
+
521
+ If a string or string[] is provided, then this is treated as a
522
+ glob pattern or array of glob patterns to exclude from matches.
523
+ To ignore all children within a directory, as well as the entry
524
+ itself, append `'/**'` to the ignore pattern.
525
+
526
+ **Note** `ignore` patterns are _always_ in `dot:true` mode,
527
+ regardless of any other settings.
528
+
529
+ If an object is provided that has `ignored(path)` and/or
530
+ `childrenIgnored(path)` methods, then these methods will be
531
+ called to determine whether any Path is a match or if its
532
+ children should be traversed, respectively.
533
+
534
+ - `follow` Follow symlinked directories when expanding `**`
535
+ patterns. This can result in a lot of duplicate references in
536
+ the presence of cyclic links, and make performance quite bad.
537
+
538
+ By default, a `**` in a pattern will follow 1 symbolic link if
539
+ it is not the first item in the pattern, or none if it is the
540
+ first item in the pattern, following the same behavior as Bash.
541
+
542
+ - `realpath` Set to true to call `fs.realpath` on all of the
543
+ results. In the case of an entry that cannot be resolved, the
544
+ entry is omitted. This incurs a slight performance penalty, of
545
+ course, because of the added system calls.
546
+
547
+ - `absolute` Set to true to always receive absolute paths for
548
+ matched files. Set to `false` to always receive relative paths
549
+ for matched files.
550
+
551
+ By default, when this option is not set, absolute paths are
552
+ returned for patterns that are absolute, and otherwise paths
553
+ are returned that are relative to the `cwd` setting.
554
+
555
+ This does _not_ make an extra system call to get the realpath,
556
+ it only does string path resolution.
557
+
558
+ `absolute` may not be used along with `withFileTypes`.
559
+
560
+ - `posix` Set to true to use `/` as the path separator in
561
+ returned results. On posix systems, this has no effect. On
562
+ Windows systems, this will return `/` delimited path results,
563
+ and absolute paths will be returned in their full resolved UNC
564
+ path form, eg insted of `'C:\\foo\\bar'`, it will return
565
+ `//?/C:/foo/bar`.
566
+
567
+ - `platform` Defaults to value of `process.platform` if
568
+ available, or `'linux'` if not. Setting `platform:'win32'` on
569
+ non-Windows systems may cause strange behavior.
570
+
571
+ - `withFileTypes` Return [PathScurry](http://npm.im/path-scurry)
572
+ `Path` objects instead of strings. These are similar to a
573
+ NodeJS `Dirent` object, but with additional methods and
574
+ properties.
575
+
576
+ `withFileTypes` may not be used along with `absolute`.
577
+
578
+ - `signal` An AbortSignal which will cancel the Glob walk when
579
+ triggered.
580
+
581
+ - `fs` An override object to pass in custom filesystem methods.
582
+ See [PathScurry docs](http://npm.im/path-scurry) for what can
583
+ be overridden.
584
+
585
+ - `scurry` A [PathScurry](http://npm.im/path-scurry) object used
586
+ to traverse the file system. If the `nocase` option is set
587
+ explicitly, then any provided `scurry` object must match this
588
+ setting.
589
+
590
+ ## Glob Primer
591
+
592
+ Much more information about glob pattern expansion can be found
593
+ by running `man bash` and searching for `Pattern Matching`.
594
+
595
+ "Globs" are the patterns you type when you do stuff like `ls
596
+ *.js` on the command line, or put `build/*` in a `.gitignore`
597
+ file.
598
+
599
+ Before parsing the path part patterns, braced sections are
600
+ expanded into a set. Braced sections start with `{` and end with
601
+ `}`, with 2 or more comma-delimited sections within. Braced
602
+ sections may contain slash characters, so `a{/b/c,bcd}` would
603
+ expand into `a/b/c` and `abcd`.
604
+
605
+ The following characters have special magic meaning when used in
606
+ a path portion. With the exception of `**`, none of these match
607
+ path separators (ie, `/` on all platforms, and `\` on Windows).
608
+
609
+ - `*` Matches 0 or more characters in a single path portion.
610
+ When alone in a path portion, it must match at least 1
611
+ character. If `dot:true` is not specified, then `*` will not
612
+ match against a `.` character at the start of a path portion.
613
+ - `?` Matches 1 character. If `dot:true` is not specified, then
614
+ `?` will not match against a `.` character at the start of a
615
+ path portion.
616
+ - `[...]` Matches a range of characters, similar to a RegExp
617
+ range. If the first character of the range is `!` or `^` then
618
+ it matches any character not in the range. If the first
619
+ character is `]`, then it will be considered the same as `\]`,
620
+ rather than the end of the character class.
621
+ - `!(pattern|pattern|pattern)` Matches anything that does not
622
+ match any of the patterns provided. May _not_ contain `/`
623
+ characters. Similar to `*`, if alone in a path portion, then
624
+ the path portion must have at least one character.
625
+ - `?(pattern|pattern|pattern)` Matches zero or one occurrence of
626
+ the patterns provided. May _not_ contain `/` characters.
627
+ - `+(pattern|pattern|pattern)` Matches one or more occurrences of
628
+ the patterns provided. May _not_ contain `/` characters.
629
+ - `*(a|b|c)` Matches zero or more occurrences of the patterns
630
+ provided. May _not_ contain `/` characters.
631
+ - `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns
632
+ provided. May _not_ contain `/` characters.
633
+ - `**` If a "globstar" is alone in a path portion, then it
634
+ matches zero or more directories and subdirectories searching
635
+ for matches. It does not crawl symlinked directories, unless
636
+ `{follow:true}` is passed in the options object. A pattern
637
+ like `a/b/**` will only match `a/b` if it is a directory.
638
+ Follows 1 symbolic link if not the first item in the pattern,
639
+ or 0 if it is the first item, unless `follow:true` is set, in
640
+ which case it follows all symbolic links.
641
+
642
+ `[:class:]` patterns are supported by this implementation, but
643
+ `[=c=]` and `[.symbol.]` style class patterns are not.
644
+
645
+ ### Dots
646
+
647
+ If a file or directory path portion has a `.` as the first
648
+ character, then it will not match any glob pattern unless that
649
+ pattern's corresponding path part also has a `.` as its first
650
+ character.
651
+
652
+ For example, the pattern `a/.*/c` would match the file at
653
+ `a/.b/c`. However the pattern `a/*/c` would not, because `*` does
654
+ not start with a dot character.
655
+
656
+ You can make glob treat dots as normal characters by setting
657
+ `dot:true` in the options.
658
+
659
+ ### Basename Matching
660
+
661
+ If you set `matchBase:true` in the options, and the pattern has
662
+ no slashes in it, then it will seek for any file anywhere in the
663
+ tree with a matching basename. For example, `*.js` would match
664
+ `test/simple/basic.js`.
665
+
666
+ ### Empty Sets
667
+
668
+ If no matching files are found, then an empty array is returned.
669
+ This differs from the shell, where the pattern itself is
670
+ returned. For example:
671
+
672
+ ```sh
673
+ $ echo a*s*d*f
674
+ a*s*d*f
675
+ ```
676
+
677
+ ## Comparisons to other fnmatch/glob implementations
678
+
679
+ While strict compliance with the existing standards is a
680
+ worthwhile goal, some discrepancies exist between node-glob and
681
+ other implementations, and are intentional.
682
+
683
+ The double-star character `**` is supported by default, unless
684
+ the `noglobstar` flag is set. This is supported in the manner of
685
+ bsdglob and bash 5, where `**` only has special significance if
686
+ it is the only thing in a path part. That is, `a/**/b` will match
687
+ `a/x/y/b`, but `a/**b` will not.
688
+
689
+ Note that symlinked directories are not traversed as part of a
690
+ `**`, though their contents may match against subsequent portions
691
+ of the pattern. This prevents infinite loops and duplicates and
692
+ the like. You can force glob to traverse symlinks with `**` by
693
+ setting `{follow:true}` in the options.
694
+
695
+ There is no equivalent of the `nonull` option. A pattern that
696
+ does not find any matches simply resolves to nothing. (An empty
697
+ array, immediately ended stream, etc.)
698
+
699
+ If brace expansion is not disabled, then it is performed before
700
+ any other interpretation of the glob pattern. Thus, a pattern
701
+ like `+(a|{b),c)}`, which would not be valid in bash or zsh, is
702
+ expanded **first** into the set of `+(a|b)` and `+(a|c)`, and
703
+ those patterns are checked for validity. Since those two are
704
+ valid, matching proceeds.
705
+
706
+ The character class patterns `[:class:]` (posix standard named
707
+ classes) style class patterns are supported and unicode-aware,
708
+ but `[=c=]` (locale-specific character collation weight), and
709
+ `[.symbol.]` (collating symbol), are not.
710
+
711
+ ### Repeated Slashes
712
+
713
+ Unlike Bash and zsh, repeated `/` are always coalesced into a
714
+ single path separator.
715
+
716
+ ### Comments and Negation
717
+
718
+ Previously, this module let you mark a pattern as a "comment" if
719
+ it started with a `#` character, or a "negated" pattern if it
720
+ started with a `!` character.
721
+
722
+ These options were deprecated in version 5, and removed in
723
+ version 6.
724
+
725
+ To specify things that should not match, use the `ignore` option.
726
+
727
+ ## Windows
728
+
729
+ **Please only use forward-slashes in glob expressions.**
730
+
731
+ Though windows uses either `/` or `\` as its path separator, only
732
+ `/` characters are used by this glob implementation. You must use
733
+ forward-slashes **only** in glob expressions. Back-slashes will
734
+ always be interpreted as escape characters, not path separators.
735
+
736
+ Results from absolute patterns such as `/foo/*` are mounted onto
737
+ the root setting using `path.join`. On windows, this will by
738
+ default result in `/foo/*` matching `C:\foo\bar.txt`.
739
+
740
+ To automatically coerce all `\` characters to `/` in pattern
741
+ strings, **thus making it impossible to escape literal glob
742
+ characters**, you may set the `windowsPathsNoEscape` option to
743
+ `true`.
744
+
745
+ ### Windows, CWDs, Drive Letters, and UNC Paths
746
+
747
+ On posix systems, when a pattern starts with `/`, any `cwd`
748
+ option is ignored, and the traversal starts at `/`, plus any
749
+ non-magic path portions specified in the pattern.
750
+
751
+ On Windows systems, the behavior is similar, but the concept of
752
+ an "absolute path" is somewhat more involved.
753
+
754
+ #### UNC Paths
755
+
756
+ A UNC path may be used as the start of a pattern on Windows
757
+ platforms. For example, a pattern like: `//?/x:/*` will return
758
+ all file entries in the root of the `x:` drive. A pattern like
759
+ `//ComputerName/Share/*` will return all files in the associated
760
+ share.
761
+
762
+ UNC path roots are always compared case insensitively.
763
+
764
+ #### Drive Letters
765
+
766
+ A pattern starting with a drive letter, like `c:/*`, will search
767
+ in that drive, regardless of any `cwd` option provided.
768
+
769
+ If the pattern starts with `/`, and is not a UNC path, and there
770
+ is an explicit `cwd` option set with a drive letter, then the
771
+ drive letter in the `cwd` is used as the root of the directory
772
+ traversal.
773
+
774
+ For example, `glob('/tmp', { cwd: 'c:/any/thing' })` will return
775
+ `['c:/tmp']` as the result.
776
+
777
+ If an explicit `cwd` option is not provided, and the pattern
778
+ starts with `/`, then the traversal will run on the root of the
779
+ drive provided as the `cwd` option. (That is, it is the result of
780
+ `path.resolve('/')`.)
781
+
782
+ ## Race Conditions
783
+
784
+ Glob searching, by its very nature, is susceptible to race
785
+ conditions, since it relies on directory walking.
786
+
787
+ As a result, it is possible that a file that exists when glob
788
+ looks for it may have been deleted or modified by the time it
789
+ returns the result.
790
+
791
+ By design, this implementation caches all readdir calls that it
792
+ makes, in order to cut down on system overhead. However, this
793
+ also makes it even more susceptible to races, especially if the
794
+ cache object is reused between glob calls.
795
+
796
+ Users are thus advised not to use a glob result as a guarantee of
797
+ filesystem state in the face of rapid changes. For the vast
798
+ majority of operations, this is never a problem.
799
+
800
+ ### See Also:
801
+
802
+ - `man sh`
803
+ - `man bash` [Pattern
804
+ Matching](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html)
805
+ - `man 3 fnmatch`
806
+ - `man 5 gitignore`
807
+ - [minimatch documentation](https://github.com/isaacs/minimatch)
808
+
809
+ ## Glob Logo
810
+
811
+ Glob's logo was created by [Tanya
812
+ Brassie](http://tanyabrassie.com/). Logo files can be found
813
+ [here](https://github.com/isaacs/node-glob/tree/master/logo).
814
+
815
+ The logo is licensed under a [Creative Commons
816
+ Attribution-ShareAlike 4.0 International
817
+ License](https://creativecommons.org/licenses/by-sa/4.0/).
818
+
819
+ ## Contributing
820
+
821
+ Any change to behavior (including bugfixes) must come with a
822
+ test.
823
+
824
+ Patches that fail tests or reduce performance will be rejected.
825
+
826
+ ```sh
827
+ # to run tests
828
+ npm test
829
+
830
+ # to re-generate test fixtures
831
+ npm run test-regen
832
+
833
+ # run the benchmarks
834
+ npm run bench
835
+
836
+ # to profile javascript
837
+ npm run prof
838
+ ```
839
+
840
+ ## Comparison to Other JavaScript Glob Implementations
841
+
842
+ **tl;dr**
843
+
844
+ - If you want glob matching that is as faithful as possible to
845
+ Bash pattern expansion semantics, and as fast as possible
846
+ within that constraint, _use this module_.
847
+ - If you are reasonably sure that the patterns you will encounter
848
+ are relatively simple, and want the absolutely fastest glob
849
+ matcher out there, _use [fast-glob](http://npm.im/fast-glob)_.
850
+ - If you are reasonably sure that the patterns you will encounter
851
+ are relatively simple, and want the convenience of
852
+ automatically respecting `.gitignore` files, _use
853
+ [globby](http://npm.im/globby)_.
854
+
855
+ There are some other glob matcher libraries on npm, but these
856
+ three are (in my opinion, as of 2023) the best.
857
+
858
+ ---
859
+
860
+ **full explanation**
861
+
862
+ Every library reflects a set of opinions and priorities in the
863
+ trade-offs it makes. Other than this library, I can personally
864
+ recommend both [globby](http://npm.im/globby) and
865
+ [fast-glob](http://npm.im/fast-glob), though they differ in their
866
+ benefits and drawbacks.
867
+
868
+ Both have very nice APIs and are reasonably fast.
869
+
870
+ `fast-glob` is, as far as I am aware, the fastest glob
871
+ implementation in JavaScript today. However, there are many
872
+ cases where the choices that `fast-glob` makes in pursuit of
873
+ speed mean that its results differ from the results returned by
874
+ Bash and other sh-like shells, which may be surprising.
875
+
876
+ In my testing, `fast-glob` is around 10-20% faster than this
877
+ module when walking over 200k files nested 4 directories
878
+ deep[1](#fn-webscale). However, there are some inconsistencies
879
+ with Bash matching behavior that this module does not suffer
880
+ from:
881
+
882
+ - `**` only matches files, not directories
883
+ - `..` path portions are not handled unless they appear at the
884
+ start of the pattern
885
+ - `./!(<pattern>)` will not match any files that _start_ with
886
+ `<pattern>`, even if they do not match `<pattern>`. For
887
+ example, `!(9).txt` will not match `9999.txt`.
888
+ - Some brace patterns in the middle of a pattern will result in
889
+ failing to find certain matches.
890
+ - Extglob patterns are allowed to contain `/` characters.
891
+
892
+ Globby exhibits all of the same pattern semantics as fast-glob,
893
+ (as it is a wrapper around fast-glob) and is slightly slower than
894
+ node-glob (by about 10-20% in the benchmark test set, or in other
895
+ words, anywhere from 20-50% slower than fast-glob). However, it
896
+ adds some API conveniences that may be worth the costs.
897
+
898
+ - Support for `.gitignore` and other ignore files.
899
+ - Support for negated globs (ie, patterns starting with `!`
900
+ rather than using a separate `ignore` option).
901
+
902
+ The priority of this module is "correctness" in the sense of
903
+ performing a glob pattern expansion as faithfully as possible to
904
+ the behavior of Bash and other sh-like shells, with as much speed
905
+ as possible.
906
+
907
+ Note that prior versions of `node-glob` are _not_ on this list.
908
+ Former versions of this module are far too slow for any cases
909
+ where performance matters at all, and were designed with APIs
910
+ that are extremely dated by current JavaScript standards.
911
+
912
+ ---
913
+
914
+ <small id="fn-webscale">[1]: In the cases where this module
915
+ returns results and `fast-glob` doesn't, it's even faster, of
916
+ course.</small>
917
+
918
+ ![lumpy space princess saying 'oh my GLOB'](https://github.com/isaacs/node-glob/raw/main/oh-my-glob.gif)
919
+
920
+ ### Benchmark Results
921
+
922
+ First number is time, smaller is better.
923
+
924
+ Second number is the count of results returned.
925
+
926
+ ```
927
+ --- pattern: '**' ---
928
+ ~~ sync ~~
929
+ node fast-glob sync 0m0.598s 200364
930
+ node globby sync 0m0.765s 200364
931
+ node current globSync mjs 0m0.683s 222656
932
+ node current glob syncStream 0m0.649s 222656
933
+ ~~ async ~~
934
+ node fast-glob async 0m0.350s 200364
935
+ node globby async 0m0.509s 200364
936
+ node current glob async mjs 0m0.463s 222656
937
+ node current glob stream 0m0.411s 222656
938
+
939
+ --- pattern: '**/..' ---
940
+ ~~ sync ~~
941
+ node fast-glob sync 0m0.486s 0
942
+ node globby sync 0m0.769s 200364
943
+ node current globSync mjs 0m0.564s 2242
944
+ node current glob syncStream 0m0.583s 2242
945
+ ~~ async ~~
946
+ node fast-glob async 0m0.283s 0
947
+ node globby async 0m0.512s 200364
948
+ node current glob async mjs 0m0.299s 2242
949
+ node current glob stream 0m0.312s 2242
950
+
951
+ --- pattern: './**/0/**/0/**/0/**/0/**/*.txt' ---
952
+ ~~ sync ~~
953
+ node fast-glob sync 0m0.490s 10
954
+ node globby sync 0m0.517s 10
955
+ node current globSync mjs 0m0.540s 10
956
+ node current glob syncStream 0m0.550s 10
957
+ ~~ async ~~
958
+ node fast-glob async 0m0.290s 10
959
+ node globby async 0m0.296s 10
960
+ node current glob async mjs 0m0.278s 10
961
+ node current glob stream 0m0.302s 10
962
+
963
+ --- pattern: './**/[01]/**/[12]/**/[23]/**/[45]/**/*.txt' ---
964
+ ~~ sync ~~
965
+ node fast-glob sync 0m0.500s 160
966
+ node globby sync 0m0.528s 160
967
+ node current globSync mjs 0m0.556s 160
968
+ node current glob syncStream 0m0.573s 160
969
+ ~~ async ~~
970
+ node fast-glob async 0m0.283s 160
971
+ node globby async 0m0.301s 160
972
+ node current glob async mjs 0m0.306s 160
973
+ node current glob stream 0m0.322s 160
974
+
975
+ --- pattern: './**/0/**/0/**/*.txt' ---
976
+ ~~ sync ~~
977
+ node fast-glob sync 0m0.502s 5230
978
+ node globby sync 0m0.527s 5230
979
+ node current globSync mjs 0m0.544s 5230
980
+ node current glob syncStream 0m0.557s 5230
981
+ ~~ async ~~
982
+ node fast-glob async 0m0.285s 5230
983
+ node globby async 0m0.305s 5230
984
+ node current glob async mjs 0m0.304s 5230
985
+ node current glob stream 0m0.310s 5230
986
+
987
+ --- pattern: '**/*.txt' ---
988
+ ~~ sync ~~
989
+ node fast-glob sync 0m0.580s 200023
990
+ node globby sync 0m0.771s 200023
991
+ node current globSync mjs 0m0.685s 200023
992
+ node current glob syncStream 0m0.649s 200023
993
+ ~~ async ~~
994
+ node fast-glob async 0m0.349s 200023
995
+ node globby async 0m0.509s 200023
996
+ node current glob async mjs 0m0.427s 200023
997
+ node current glob stream 0m0.388s 200023
998
+
999
+ --- pattern: '{**/*.txt,**/?/**/*.txt,**/?/**/?/**/*.txt,**/?/**/?/**/?/**/*.txt,**/?/**/?/**/?/**/?/**/*.txt}' ---
1000
+ ~~ sync ~~
1001
+ node fast-glob sync 0m0.589s 200023
1002
+ node globby sync 0m0.771s 200023
1003
+ node current globSync mjs 0m0.716s 200023
1004
+ node current glob syncStream 0m0.684s 200023
1005
+ ~~ async ~~
1006
+ node fast-glob async 0m0.351s 200023
1007
+ node globby async 0m0.518s 200023
1008
+ node current glob async mjs 0m0.462s 200023
1009
+ node current glob stream 0m0.468s 200023
1010
+
1011
+ --- pattern: '**/5555/0000/*.txt' ---
1012
+ ~~ sync ~~
1013
+ node fast-glob sync 0m0.496s 1000
1014
+ node globby sync 0m0.519s 1000
1015
+ node current globSync mjs 0m0.539s 1000
1016
+ node current glob syncStream 0m0.567s 1000
1017
+ ~~ async ~~
1018
+ node fast-glob async 0m0.285s 1000
1019
+ node globby async 0m0.299s 1000
1020
+ node current glob async mjs 0m0.305s 1000
1021
+ node current glob stream 0m0.301s 1000
1022
+
1023
+ --- pattern: './**/0/**/../[01]/**/0/../**/0/*.txt' ---
1024
+ ~~ sync ~~
1025
+ node fast-glob sync 0m0.484s 0
1026
+ node globby sync 0m0.507s 0
1027
+ node current globSync mjs 0m0.577s 4880
1028
+ node current glob syncStream 0m0.586s 4880
1029
+ ~~ async ~~
1030
+ node fast-glob async 0m0.280s 0
1031
+ node globby async 0m0.298s 0
1032
+ node current glob async mjs 0m0.327s 4880
1033
+ node current glob stream 0m0.324s 4880
1034
+
1035
+ --- pattern: '**/????/????/????/????/*.txt' ---
1036
+ ~~ sync ~~
1037
+ node fast-glob sync 0m0.547s 100000
1038
+ node globby sync 0m0.673s 100000
1039
+ node current globSync mjs 0m0.626s 100000
1040
+ node current glob syncStream 0m0.618s 100000
1041
+ ~~ async ~~
1042
+ node fast-glob async 0m0.315s 100000
1043
+ node globby async 0m0.414s 100000
1044
+ node current glob async mjs 0m0.366s 100000
1045
+ node current glob stream 0m0.345s 100000
1046
+
1047
+ --- pattern: './{**/?{/**/?{/**/?{/**/?,,,,},,,,},,,,},,,}/**/*.txt' ---
1048
+ ~~ sync ~~
1049
+ node fast-glob sync 0m0.588s 100000
1050
+ node globby sync 0m0.670s 100000
1051
+ node current globSync mjs 0m0.717s 200023
1052
+ node current glob syncStream 0m0.687s 200023
1053
+ ~~ async ~~
1054
+ node fast-glob async 0m0.343s 100000
1055
+ node globby async 0m0.418s 100000
1056
+ node current glob async mjs 0m0.519s 200023
1057
+ node current glob stream 0m0.451s 200023
1058
+
1059
+ --- pattern: '**/!(0|9).txt' ---
1060
+ ~~ sync ~~
1061
+ node fast-glob sync 0m0.573s 160023
1062
+ node globby sync 0m0.731s 160023
1063
+ node current globSync mjs 0m0.680s 180023
1064
+ node current glob syncStream 0m0.659s 180023
1065
+ ~~ async ~~
1066
+ node fast-glob async 0m0.345s 160023
1067
+ node globby async 0m0.476s 160023
1068
+ node current glob async mjs 0m0.427s 180023
1069
+ node current glob stream 0m0.388s 180023
1070
+
1071
+ --- pattern: './{*/**/../{*/**/../{*/**/../{*/**/../{*/**,,,,},,,,},,,,},,,,},,,,}/*.txt' ---
1072
+ ~~ sync ~~
1073
+ node fast-glob sync 0m0.483s 0
1074
+ node globby sync 0m0.512s 0
1075
+ node current globSync mjs 0m0.811s 200023
1076
+ node current glob syncStream 0m0.773s 200023
1077
+ ~~ async ~~
1078
+ node fast-glob async 0m0.280s 0
1079
+ node globby async 0m0.299s 0
1080
+ node current glob async mjs 0m0.617s 200023
1081
+ node current glob stream 0m0.568s 200023
1082
+
1083
+ --- pattern: './*/**/../*/**/../*/**/../*/**/../*/**/../*/**/../*/**/../*/**/*.txt' ---
1084
+ ~~ sync ~~
1085
+ node fast-glob sync 0m0.485s 0
1086
+ node globby sync 0m0.507s 0
1087
+ node current globSync mjs 0m0.759s 200023
1088
+ node current glob syncStream 0m0.740s 200023
1089
+ ~~ async ~~
1090
+ node fast-glob async 0m0.281s 0
1091
+ node globby async 0m0.297s 0
1092
+ node current glob async mjs 0m0.544s 200023
1093
+ node current glob stream 0m0.464s 200023
1094
+
1095
+ --- pattern: './*/**/../*/**/../*/**/../*/**/../*/**/*.txt' ---
1096
+ ~~ sync ~~
1097
+ node fast-glob sync 0m0.486s 0
1098
+ node globby sync 0m0.513s 0
1099
+ node current globSync mjs 0m0.734s 200023
1100
+ node current glob syncStream 0m0.696s 200023
1101
+ ~~ async ~~
1102
+ node fast-glob async 0m0.286s 0
1103
+ node globby async 0m0.296s 0
1104
+ node current glob async mjs 0m0.506s 200023
1105
+ node current glob stream 0m0.483s 200023
1106
+
1107
+ --- pattern: './0/**/../1/**/../2/**/../3/**/../4/**/../5/**/../6/**/../7/**/*.txt' ---
1108
+ ~~ sync ~~
1109
+ node fast-glob sync 0m0.060s 0
1110
+ node globby sync 0m0.074s 0
1111
+ node current globSync mjs 0m0.067s 0
1112
+ node current glob syncStream 0m0.066s 0
1113
+ ~~ async ~~
1114
+ node fast-glob async 0m0.060s 0
1115
+ node globby async 0m0.075s 0
1116
+ node current glob async mjs 0m0.066s 0
1117
+ node current glob stream 0m0.067s 0
1118
+
1119
+ --- pattern: './**/?/**/?/**/?/**/?/**/*.txt' ---
1120
+ ~~ sync ~~
1121
+ node fast-glob sync 0m0.568s 100000
1122
+ node globby sync 0m0.651s 100000
1123
+ node current globSync mjs 0m0.619s 100000
1124
+ node current glob syncStream 0m0.617s 100000
1125
+ ~~ async ~~
1126
+ node fast-glob async 0m0.332s 100000
1127
+ node globby async 0m0.409s 100000
1128
+ node current glob async mjs 0m0.372s 100000
1129
+ node current glob stream 0m0.351s 100000
1130
+
1131
+ --- pattern: '**/*/**/*/**/*/**/*/**' ---
1132
+ ~~ sync ~~
1133
+ node fast-glob sync 0m0.603s 200113
1134
+ node globby sync 0m0.798s 200113
1135
+ node current globSync mjs 0m0.730s 222137
1136
+ node current glob syncStream 0m0.693s 222137
1137
+ ~~ async ~~
1138
+ node fast-glob async 0m0.356s 200113
1139
+ node globby async 0m0.525s 200113
1140
+ node current glob async mjs 0m0.508s 222137
1141
+ node current glob stream 0m0.455s 222137
1142
+
1143
+ --- pattern: './**/*/**/*/**/*/**/*/**/*.txt' ---
1144
+ ~~ sync ~~
1145
+ node fast-glob sync 0m0.622s 200000
1146
+ node globby sync 0m0.792s 200000
1147
+ node current globSync mjs 0m0.722s 200000
1148
+ node current glob syncStream 0m0.695s 200000
1149
+ ~~ async ~~
1150
+ node fast-glob async 0m0.369s 200000
1151
+ node globby async 0m0.527s 200000
1152
+ node current glob async mjs 0m0.502s 200000
1153
+ node current glob stream 0m0.481s 200000
1154
+
1155
+ --- pattern: '**/*.txt' ---
1156
+ ~~ sync ~~
1157
+ node fast-glob sync 0m0.588s 200023
1158
+ node globby sync 0m0.771s 200023
1159
+ node current globSync mjs 0m0.684s 200023
1160
+ node current glob syncStream 0m0.658s 200023
1161
+ ~~ async ~~
1162
+ node fast-glob async 0m0.352s 200023
1163
+ node globby async 0m0.516s 200023
1164
+ node current glob async mjs 0m0.432s 200023
1165
+ node current glob stream 0m0.384s 200023
1166
+
1167
+ --- pattern: './**/**/**/**/**/**/**/**/*.txt' ---
1168
+ ~~ sync ~~
1169
+ node fast-glob sync 0m0.589s 200023
1170
+ node globby sync 0m0.766s 200023
1171
+ node current globSync mjs 0m0.682s 200023
1172
+ node current glob syncStream 0m0.652s 200023
1173
+ ~~ async ~~
1174
+ node fast-glob async 0m0.352s 200023
1175
+ node globby async 0m0.523s 200023
1176
+ node current glob async mjs 0m0.436s 200023
1177
+ node current glob stream 0m0.380s 200023
1178
+
1179
+ --- pattern: '**/*/*.txt' ---
1180
+ ~~ sync ~~
1181
+ node fast-glob sync 0m0.592s 200023
1182
+ node globby sync 0m0.776s 200023
1183
+ node current globSync mjs 0m0.691s 200023
1184
+ node current glob syncStream 0m0.659s 200023
1185
+ ~~ async ~~
1186
+ node fast-glob async 0m0.357s 200023
1187
+ node globby async 0m0.513s 200023
1188
+ node current glob async mjs 0m0.471s 200023
1189
+ node current glob stream 0m0.424s 200023
1190
+
1191
+ --- pattern: '**/*/**/*.txt' ---
1192
+ ~~ sync ~~
1193
+ node fast-glob sync 0m0.585s 200023
1194
+ node globby sync 0m0.766s 200023
1195
+ node current globSync mjs 0m0.694s 200023
1196
+ node current glob syncStream 0m0.664s 200023
1197
+ ~~ async ~~
1198
+ node fast-glob async 0m0.350s 200023
1199
+ node globby async 0m0.514s 200023
1200
+ node current glob async mjs 0m0.472s 200023
1201
+ node current glob stream 0m0.424s 200023
1202
+
1203
+ --- pattern: '**/[0-9]/**/*.txt' ---
1204
+ ~~ sync ~~
1205
+ node fast-glob sync 0m0.544s 100000
1206
+ node globby sync 0m0.636s 100000
1207
+ node current globSync mjs 0m0.626s 100000
1208
+ node current glob syncStream 0m0.621s 100000
1209
+ ~~ async ~~
1210
+ node fast-glob async 0m0.322s 100000
1211
+ node globby async 0m0.404s 100000
1212
+ node current glob async mjs 0m0.360s 100000
1213
+ node current glob stream 0m0.352s 100000
1214
+ ```