decidim 0.27.3 → 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 (223) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +16 -2
  3. data/babel.config.json +1 -4
  4. data/lib/decidim/release_manager.rb.new +43 -0
  5. data/lib/decidim/version.rb +1 -1
  6. data/package-lock.json +343 -255
  7. data/packages/browserslist-config/package.json +1 -1
  8. data/packages/core/node_modules/diff/CONTRIBUTING.md +39 -0
  9. data/packages/core/node_modules/diff/LICENSE +31 -0
  10. data/packages/core/node_modules/diff/README.md +211 -0
  11. data/packages/core/node_modules/diff/dist/diff.js +1627 -0
  12. data/packages/core/node_modules/diff/dist/diff.min.js +38 -0
  13. data/packages/core/node_modules/diff/lib/convert/dmp.js +32 -0
  14. data/packages/core/node_modules/diff/lib/convert/xml.js +42 -0
  15. data/packages/core/node_modules/diff/lib/diff/array.js +45 -0
  16. data/packages/core/node_modules/diff/lib/diff/base.js +307 -0
  17. data/packages/core/node_modules/diff/lib/diff/character.js +37 -0
  18. data/packages/core/node_modules/diff/lib/diff/css.js +41 -0
  19. data/packages/core/node_modules/diff/lib/diff/json.js +163 -0
  20. data/packages/core/node_modules/diff/lib/diff/line.js +89 -0
  21. data/packages/core/node_modules/diff/lib/diff/sentence.js +41 -0
  22. data/packages/core/node_modules/diff/lib/diff/word.js +108 -0
  23. data/packages/core/node_modules/diff/lib/index.es6.js +1561 -0
  24. data/packages/core/node_modules/diff/lib/index.js +216 -0
  25. data/packages/core/node_modules/diff/lib/index.mjs +1561 -0
  26. data/packages/core/node_modules/diff/lib/patch/apply.js +238 -0
  27. data/packages/core/node_modules/diff/lib/patch/create.js +272 -0
  28. data/packages/core/node_modules/diff/lib/patch/merge.js +613 -0
  29. data/packages/core/node_modules/diff/lib/patch/parse.js +167 -0
  30. data/packages/core/node_modules/diff/lib/util/array.js +32 -0
  31. data/packages/core/node_modules/diff/lib/util/distance-iterator.js +57 -0
  32. data/packages/core/node_modules/diff/lib/util/params.js +24 -0
  33. data/packages/core/node_modules/diff/package.json +87 -0
  34. data/packages/core/node_modules/diff/release-notes.md +309 -0
  35. data/packages/core/node_modules/diff/runtime.js +3 -0
  36. data/packages/core/package-lock.json +4889 -0
  37. data/packages/core/package.json +1 -1
  38. data/packages/dev/package.json +1 -1
  39. data/packages/elections/package.json +1 -1
  40. data/packages/eslint-config/package.json +1 -1
  41. data/packages/stylelint-config/package.json +1 -1
  42. data/packages/webpacker/node_modules/argparse/CHANGELOG.md +216 -0
  43. data/packages/webpacker/node_modules/argparse/LICENSE +254 -0
  44. data/packages/webpacker/node_modules/argparse/README.md +84 -0
  45. data/packages/webpacker/node_modules/argparse/argparse.js +3707 -0
  46. data/packages/webpacker/node_modules/argparse/lib/sub.js +67 -0
  47. data/packages/webpacker/node_modules/argparse/lib/textwrap.js +440 -0
  48. data/packages/webpacker/node_modules/argparse/package.json +31 -0
  49. data/packages/{core/node_modules/uuid/LICENSE.md → webpacker/node_modules/brace-expansion/LICENSE} +2 -2
  50. data/packages/webpacker/node_modules/brace-expansion/README.md +135 -0
  51. data/packages/webpacker/node_modules/brace-expansion/index.js +203 -0
  52. data/packages/webpacker/node_modules/brace-expansion/package.json +46 -0
  53. data/packages/webpacker/node_modules/glob/LICENSE +15 -0
  54. data/packages/webpacker/node_modules/glob/README.md +1214 -0
  55. data/packages/webpacker/node_modules/glob/dist/cjs/package.json +4 -0
  56. data/packages/webpacker/node_modules/glob/dist/cjs/src/bin.d.ts +3 -0
  57. data/packages/webpacker/node_modules/glob/dist/cjs/src/bin.d.ts.map +1 -0
  58. data/packages/webpacker/node_modules/glob/dist/cjs/src/bin.js +270 -0
  59. data/packages/webpacker/node_modules/glob/dist/cjs/src/bin.js.map +1 -0
  60. data/packages/webpacker/node_modules/glob/dist/cjs/src/glob.d.ts +344 -0
  61. data/packages/webpacker/node_modules/glob/dist/cjs/src/glob.d.ts.map +1 -0
  62. data/packages/webpacker/node_modules/glob/dist/cjs/src/glob.js +238 -0
  63. data/packages/webpacker/node_modules/glob/dist/cjs/src/glob.js.map +1 -0
  64. data/packages/webpacker/node_modules/glob/dist/cjs/src/has-magic.d.ts +14 -0
  65. data/packages/webpacker/node_modules/glob/dist/cjs/src/has-magic.d.ts.map +1 -0
  66. data/packages/webpacker/node_modules/glob/dist/cjs/src/has-magic.js +27 -0
  67. data/packages/webpacker/node_modules/glob/dist/cjs/src/has-magic.js.map +1 -0
  68. data/packages/webpacker/node_modules/glob/dist/cjs/src/ignore.d.ts +20 -0
  69. data/packages/webpacker/node_modules/glob/dist/cjs/src/ignore.d.ts.map +1 -0
  70. data/packages/webpacker/node_modules/glob/dist/cjs/src/ignore.js +103 -0
  71. data/packages/webpacker/node_modules/glob/dist/cjs/src/ignore.js.map +1 -0
  72. data/packages/webpacker/node_modules/glob/dist/cjs/src/index.d.ts +95 -0
  73. data/packages/webpacker/node_modules/glob/dist/cjs/src/index.d.ts.map +1 -0
  74. data/packages/webpacker/node_modules/glob/dist/cjs/src/index.js +68 -0
  75. data/packages/webpacker/node_modules/glob/dist/cjs/src/index.js.map +1 -0
  76. data/packages/webpacker/node_modules/glob/dist/cjs/src/pattern.d.ts +77 -0
  77. data/packages/webpacker/node_modules/glob/dist/cjs/src/pattern.d.ts.map +1 -0
  78. data/packages/webpacker/node_modules/glob/dist/cjs/src/pattern.js +219 -0
  79. data/packages/webpacker/node_modules/glob/dist/cjs/src/pattern.js.map +1 -0
  80. data/packages/webpacker/node_modules/glob/dist/cjs/src/processor.d.ts +59 -0
  81. data/packages/webpacker/node_modules/glob/dist/cjs/src/processor.d.ts.map +1 -0
  82. data/packages/webpacker/node_modules/glob/dist/cjs/src/processor.js +309 -0
  83. data/packages/webpacker/node_modules/glob/dist/cjs/src/processor.js.map +1 -0
  84. data/packages/webpacker/node_modules/glob/dist/cjs/src/walker.d.ts +96 -0
  85. data/packages/webpacker/node_modules/glob/dist/cjs/src/walker.d.ts.map +1 -0
  86. data/packages/webpacker/node_modules/glob/dist/cjs/src/walker.js +358 -0
  87. data/packages/webpacker/node_modules/glob/dist/cjs/src/walker.js.map +1 -0
  88. data/packages/webpacker/node_modules/glob/dist/mjs/glob.d.ts +344 -0
  89. data/packages/webpacker/node_modules/glob/dist/mjs/glob.d.ts.map +1 -0
  90. data/packages/webpacker/node_modules/glob/dist/mjs/glob.js +234 -0
  91. data/packages/webpacker/node_modules/glob/dist/mjs/glob.js.map +1 -0
  92. data/packages/webpacker/node_modules/glob/dist/mjs/has-magic.d.ts +14 -0
  93. data/packages/webpacker/node_modules/glob/dist/mjs/has-magic.d.ts.map +1 -0
  94. data/packages/webpacker/node_modules/glob/dist/mjs/has-magic.js +23 -0
  95. data/packages/webpacker/node_modules/glob/dist/mjs/has-magic.js.map +1 -0
  96. data/packages/webpacker/node_modules/glob/dist/mjs/ignore.d.ts +20 -0
  97. data/packages/webpacker/node_modules/glob/dist/mjs/ignore.d.ts.map +1 -0
  98. data/packages/webpacker/node_modules/glob/dist/mjs/ignore.js +99 -0
  99. data/packages/webpacker/node_modules/glob/dist/mjs/ignore.js.map +1 -0
  100. data/packages/webpacker/node_modules/glob/dist/mjs/index.d.ts +95 -0
  101. data/packages/webpacker/node_modules/glob/dist/mjs/index.d.ts.map +1 -0
  102. data/packages/webpacker/node_modules/glob/dist/mjs/index.js +56 -0
  103. data/packages/webpacker/node_modules/glob/dist/mjs/index.js.map +1 -0
  104. data/packages/webpacker/node_modules/glob/dist/mjs/package.json +4 -0
  105. data/packages/webpacker/node_modules/glob/dist/mjs/pattern.d.ts +77 -0
  106. data/packages/webpacker/node_modules/glob/dist/mjs/pattern.d.ts.map +1 -0
  107. data/packages/webpacker/node_modules/glob/dist/mjs/pattern.js +215 -0
  108. data/packages/webpacker/node_modules/glob/dist/mjs/pattern.js.map +1 -0
  109. data/packages/webpacker/node_modules/glob/dist/mjs/processor.d.ts +59 -0
  110. data/packages/webpacker/node_modules/glob/dist/mjs/processor.d.ts.map +1 -0
  111. data/packages/webpacker/node_modules/glob/dist/mjs/processor.js +302 -0
  112. data/packages/webpacker/node_modules/glob/dist/mjs/processor.js.map +1 -0
  113. data/packages/webpacker/node_modules/glob/dist/mjs/walker.d.ts +96 -0
  114. data/packages/webpacker/node_modules/glob/dist/mjs/walker.d.ts.map +1 -0
  115. data/packages/webpacker/node_modules/glob/dist/mjs/walker.js +352 -0
  116. data/packages/webpacker/node_modules/glob/dist/mjs/walker.js.map +1 -0
  117. data/packages/webpacker/node_modules/glob/package.json +98 -0
  118. data/packages/webpacker/node_modules/js-yaml/CHANGELOG.md +616 -0
  119. data/packages/webpacker/node_modules/js-yaml/LICENSE +21 -0
  120. data/packages/webpacker/node_modules/js-yaml/README.md +246 -0
  121. data/packages/webpacker/node_modules/js-yaml/bin/js-yaml.js +126 -0
  122. data/packages/webpacker/node_modules/js-yaml/dist/js-yaml.js +3874 -0
  123. data/packages/webpacker/node_modules/js-yaml/dist/js-yaml.min.js +2 -0
  124. data/packages/webpacker/node_modules/js-yaml/dist/js-yaml.mjs +3851 -0
  125. data/packages/webpacker/node_modules/js-yaml/index.js +47 -0
  126. data/packages/webpacker/node_modules/js-yaml/lib/common.js +59 -0
  127. data/packages/webpacker/node_modules/js-yaml/lib/dumper.js +965 -0
  128. data/packages/webpacker/node_modules/js-yaml/lib/exception.js +55 -0
  129. data/packages/webpacker/node_modules/js-yaml/lib/loader.js +1727 -0
  130. data/packages/webpacker/node_modules/js-yaml/lib/schema/core.js +11 -0
  131. data/packages/webpacker/node_modules/js-yaml/lib/schema/default.js +22 -0
  132. data/packages/webpacker/node_modules/js-yaml/lib/schema/failsafe.js +17 -0
  133. data/packages/webpacker/node_modules/js-yaml/lib/schema/json.js +19 -0
  134. data/packages/webpacker/node_modules/js-yaml/lib/schema.js +121 -0
  135. data/packages/webpacker/node_modules/js-yaml/lib/snippet.js +101 -0
  136. data/packages/webpacker/node_modules/js-yaml/lib/type/binary.js +125 -0
  137. data/packages/webpacker/node_modules/js-yaml/lib/type/bool.js +35 -0
  138. data/packages/webpacker/node_modules/js-yaml/lib/type/float.js +97 -0
  139. data/packages/webpacker/node_modules/js-yaml/lib/type/int.js +156 -0
  140. data/packages/webpacker/node_modules/js-yaml/lib/type/map.js +8 -0
  141. data/packages/webpacker/node_modules/js-yaml/lib/type/merge.js +12 -0
  142. data/packages/webpacker/node_modules/js-yaml/lib/type/null.js +35 -0
  143. data/packages/webpacker/node_modules/js-yaml/lib/type/omap.js +44 -0
  144. data/packages/webpacker/node_modules/js-yaml/lib/type/pairs.js +53 -0
  145. data/packages/webpacker/node_modules/js-yaml/lib/type/seq.js +8 -0
  146. data/packages/webpacker/node_modules/js-yaml/lib/type/set.js +29 -0
  147. data/packages/webpacker/node_modules/js-yaml/lib/type/str.js +8 -0
  148. data/packages/webpacker/node_modules/js-yaml/lib/type/timestamp.js +88 -0
  149. data/packages/webpacker/node_modules/js-yaml/lib/type.js +66 -0
  150. data/packages/webpacker/node_modules/js-yaml/package.json +66 -0
  151. data/packages/webpacker/node_modules/minimatch/LICENSE +15 -0
  152. data/packages/webpacker/node_modules/minimatch/README.md +454 -0
  153. data/packages/webpacker/node_modules/minimatch/dist/cjs/assert-valid-pattern.d.ts +2 -0
  154. data/packages/webpacker/node_modules/minimatch/dist/cjs/assert-valid-pattern.d.ts.map +1 -0
  155. data/packages/webpacker/node_modules/minimatch/dist/cjs/assert-valid-pattern.js +14 -0
  156. data/packages/webpacker/node_modules/minimatch/dist/cjs/assert-valid-pattern.js.map +1 -0
  157. data/packages/webpacker/node_modules/minimatch/dist/cjs/ast.d.ts +19 -0
  158. data/packages/webpacker/node_modules/minimatch/dist/cjs/ast.d.ts.map +1 -0
  159. data/packages/webpacker/node_modules/minimatch/dist/cjs/ast.js +589 -0
  160. data/packages/webpacker/node_modules/minimatch/dist/cjs/ast.js.map +1 -0
  161. data/packages/webpacker/node_modules/minimatch/dist/cjs/brace-expressions.d.ts +8 -0
  162. data/packages/webpacker/node_modules/minimatch/dist/cjs/brace-expressions.d.ts.map +1 -0
  163. data/packages/webpacker/node_modules/minimatch/dist/cjs/brace-expressions.js +152 -0
  164. data/packages/webpacker/node_modules/minimatch/dist/cjs/brace-expressions.js.map +1 -0
  165. data/packages/webpacker/node_modules/minimatch/dist/cjs/escape.d.ts +12 -0
  166. data/packages/webpacker/node_modules/minimatch/dist/cjs/escape.d.ts.map +1 -0
  167. data/packages/webpacker/node_modules/minimatch/dist/cjs/escape.js +22 -0
  168. data/packages/webpacker/node_modules/minimatch/dist/cjs/escape.js.map +1 -0
  169. data/packages/webpacker/node_modules/minimatch/dist/cjs/index.d.ts +94 -0
  170. data/packages/webpacker/node_modules/minimatch/dist/cjs/index.d.ts.map +1 -0
  171. data/packages/webpacker/node_modules/minimatch/dist/cjs/index.js +1011 -0
  172. data/packages/webpacker/node_modules/minimatch/dist/cjs/index.js.map +1 -0
  173. data/packages/webpacker/node_modules/minimatch/dist/cjs/package.json +3 -0
  174. data/packages/webpacker/node_modules/minimatch/dist/cjs/unescape.d.ts +17 -0
  175. data/packages/webpacker/node_modules/minimatch/dist/cjs/unescape.d.ts.map +1 -0
  176. data/packages/webpacker/node_modules/minimatch/dist/cjs/unescape.js +24 -0
  177. data/packages/webpacker/node_modules/minimatch/dist/cjs/unescape.js.map +1 -0
  178. data/packages/webpacker/node_modules/minimatch/dist/mjs/assert-valid-pattern.d.ts +2 -0
  179. data/packages/webpacker/node_modules/minimatch/dist/mjs/assert-valid-pattern.d.ts.map +1 -0
  180. data/packages/webpacker/node_modules/minimatch/dist/mjs/assert-valid-pattern.js +10 -0
  181. data/packages/webpacker/node_modules/minimatch/dist/mjs/assert-valid-pattern.js.map +1 -0
  182. data/packages/webpacker/node_modules/minimatch/dist/mjs/ast.d.ts +19 -0
  183. data/packages/webpacker/node_modules/minimatch/dist/mjs/ast.d.ts.map +1 -0
  184. data/packages/webpacker/node_modules/minimatch/dist/mjs/ast.js +585 -0
  185. data/packages/webpacker/node_modules/minimatch/dist/mjs/ast.js.map +1 -0
  186. data/packages/webpacker/node_modules/minimatch/dist/mjs/brace-expressions.d.ts +8 -0
  187. data/packages/webpacker/node_modules/minimatch/dist/mjs/brace-expressions.d.ts.map +1 -0
  188. data/packages/webpacker/node_modules/minimatch/dist/mjs/brace-expressions.js +148 -0
  189. data/packages/webpacker/node_modules/minimatch/dist/mjs/brace-expressions.js.map +1 -0
  190. data/packages/webpacker/node_modules/minimatch/dist/mjs/escape.d.ts +12 -0
  191. data/packages/webpacker/node_modules/minimatch/dist/mjs/escape.d.ts.map +1 -0
  192. data/packages/webpacker/node_modules/minimatch/dist/mjs/escape.js +18 -0
  193. data/packages/webpacker/node_modules/minimatch/dist/mjs/escape.js.map +1 -0
  194. data/packages/webpacker/node_modules/minimatch/dist/mjs/index.d.ts +94 -0
  195. data/packages/webpacker/node_modules/minimatch/dist/mjs/index.d.ts.map +1 -0
  196. data/packages/webpacker/node_modules/minimatch/dist/mjs/index.js +995 -0
  197. data/packages/webpacker/node_modules/minimatch/dist/mjs/index.js.map +1 -0
  198. data/packages/webpacker/node_modules/minimatch/dist/mjs/package.json +3 -0
  199. data/packages/webpacker/node_modules/minimatch/dist/mjs/unescape.d.ts +17 -0
  200. data/packages/webpacker/node_modules/minimatch/dist/mjs/unescape.d.ts.map +1 -0
  201. data/packages/webpacker/node_modules/minimatch/dist/mjs/unescape.js +20 -0
  202. data/packages/webpacker/node_modules/minimatch/dist/mjs/unescape.js.map +1 -0
  203. data/packages/webpacker/node_modules/minimatch/package.json +86 -0
  204. data/packages/webpacker/package.json +2 -2
  205. metadata +237 -64
  206. data/packages/core/node_modules/uuid/AUTHORS +0 -5
  207. data/packages/core/node_modules/uuid/CHANGELOG.md +0 -119
  208. data/packages/core/node_modules/uuid/README.md +0 -276
  209. data/packages/core/node_modules/uuid/bin/uuid +0 -65
  210. data/packages/core/node_modules/uuid/index.js +0 -8
  211. data/packages/core/node_modules/uuid/lib/bytesToUuid.js +0 -26
  212. data/packages/core/node_modules/uuid/lib/md5-browser.js +0 -216
  213. data/packages/core/node_modules/uuid/lib/md5.js +0 -25
  214. data/packages/core/node_modules/uuid/lib/rng-browser.js +0 -34
  215. data/packages/core/node_modules/uuid/lib/rng.js +0 -8
  216. data/packages/core/node_modules/uuid/lib/sha1-browser.js +0 -89
  217. data/packages/core/node_modules/uuid/lib/sha1.js +0 -25
  218. data/packages/core/node_modules/uuid/lib/v35.js +0 -57
  219. data/packages/core/node_modules/uuid/package.json +0 -49
  220. data/packages/core/node_modules/uuid/v1.js +0 -109
  221. data/packages/core/node_modules/uuid/v3.js +0 -4
  222. data/packages/core/node_modules/uuid/v4.js +0 -29
  223. data/packages/core/node_modules/uuid/v5.js +0 -3
@@ -0,0 +1,344 @@
1
+ /// <reference types="node" />
2
+ import { Minimatch } from 'minimatch';
3
+ import { Minipass } from 'minipass';
4
+ import { FSOption, Path, PathScurry } from 'path-scurry';
5
+ import { IgnoreLike } from './ignore.js';
6
+ import { Pattern } from './pattern.js';
7
+ export type MatchSet = Minimatch['set'];
8
+ export type GlobParts = Exclude<Minimatch['globParts'], undefined>;
9
+ /**
10
+ * A `GlobOptions` object may be provided to any of the exported methods, and
11
+ * must be provided to the `Glob` constructor.
12
+ *
13
+ * All options are optional, boolean, and false by default, unless otherwise
14
+ * noted.
15
+ *
16
+ * All resolved options are added to the Glob object as properties.
17
+ *
18
+ * If you are running many `glob` operations, you can pass a Glob object as the
19
+ * `options` argument to a subsequent operation to share the previously loaded
20
+ * cache.
21
+ */
22
+ export interface GlobOptions {
23
+ /**
24
+ * Set to `true` to always receive absolute paths for
25
+ * matched files. Set to `false` to always return relative paths.
26
+ *
27
+ * When this option is not set, absolute paths are returned for patterns
28
+ * that are absolute, and otherwise paths are returned that are relative
29
+ * to the `cwd` setting.
30
+ *
31
+ * This does _not_ make an extra system call to get
32
+ * the realpath, it only does string path resolution.
33
+ *
34
+ * Conflicts with {@link withFileTypes}
35
+ */
36
+ absolute?: boolean;
37
+ /**
38
+ * Set to false to enable {@link windowsPathsNoEscape}
39
+ *
40
+ * @deprecated
41
+ */
42
+ allowWindowsEscape?: boolean;
43
+ /**
44
+ * The current working directory in which to search. Defaults to
45
+ * `process.cwd()`.
46
+ *
47
+ * May be eiher a string path or a `file://` URL object or string.
48
+ */
49
+ cwd?: string | URL;
50
+ /**
51
+ * Include `.dot` files in normal matches and `globstar`
52
+ * matches. Note that an explicit dot in a portion of the pattern
53
+ * will always match dot files.
54
+ */
55
+ dot?: boolean;
56
+ /**
57
+ * Prepend all relative path strings with `./` (or `.\` on Windows).
58
+ *
59
+ * Without this option, returned relative paths are "bare", so instead of
60
+ * returning `'./foo/bar'`, they are returned as `'foo/bar'`.
61
+ *
62
+ * Relative patterns starting with `'../'` are not prepended with `./`, even
63
+ * if this option is set.
64
+ */
65
+ dotRelative?: boolean;
66
+ /**
67
+ * Follow symlinked directories when expanding `**`
68
+ * patterns. This can result in a lot of duplicate references in
69
+ * the presence of cyclic links, and make performance quite bad.
70
+ *
71
+ * By default, a `**` in a pattern will follow 1 symbolic link if
72
+ * it is not the first item in the pattern, or none if it is the
73
+ * first item in the pattern, following the same behavior as Bash.
74
+ */
75
+ follow?: boolean;
76
+ /**
77
+ * string or string[], or an object with `ignore` and `ignoreChildren`
78
+ * methods.
79
+ *
80
+ * If a string or string[] is provided, then this is treated as a glob
81
+ * pattern or array of glob patterns to exclude from matches. To ignore all
82
+ * children within a directory, as well as the entry itself, append `'/**'`
83
+ * to the ignore pattern.
84
+ *
85
+ * **Note** `ignore` patterns are _always_ in `dot:true` mode, regardless of
86
+ * any other settings.
87
+ *
88
+ * If an object is provided that has `ignored(path)` and/or
89
+ * `childrenIgnored(path)` methods, then these methods will be called to
90
+ * determine whether any Path is a match or if its children should be
91
+ * traversed, respectively.
92
+ */
93
+ ignore?: string | string[] | IgnoreLike;
94
+ /**
95
+ * Treat brace expansion like `{a,b}` as a "magic" pattern. Has no
96
+ * effect if {@link nobrace} is set.
97
+ *
98
+ * Only has effect on the {@link hasMagic} function.
99
+ */
100
+ magicalBraces?: boolean;
101
+ /**
102
+ * Add a `/` character to directory matches. Note that this requires
103
+ * additional stat calls in some cases.
104
+ */
105
+ mark?: boolean;
106
+ /**
107
+ * Perform a basename-only match if the pattern does not contain any slash
108
+ * characters. That is, `*.js` would be treated as equivalent to
109
+ * `**\/*.js`, matching all js files in all directories.
110
+ */
111
+ matchBase?: boolean;
112
+ /**
113
+ * Limit the directory traversal to a given depth below the cwd.
114
+ * Note that this does NOT prevent traversal to sibling folders,
115
+ * root patterns, and so on. It only limits the maximum folder depth
116
+ * that the walk will descend, relative to the cwd.
117
+ */
118
+ maxDepth?: number;
119
+ /**
120
+ * Do not expand `{a,b}` and `{1..3}` brace sets.
121
+ */
122
+ nobrace?: boolean;
123
+ /**
124
+ * Perform a case-insensitive match. This defaults to `true` on macOS and
125
+ * Windows systems, and `false` on all others.
126
+ *
127
+ * **Note** `nocase` should only be explicitly set when it is
128
+ * known that the filesystem's case sensitivity differs from the
129
+ * platform default. If set `true` on case-sensitive file
130
+ * systems, or `false` on case-insensitive file systems, then the
131
+ * walk may return more or less results than expected.
132
+ */
133
+ nocase?: boolean;
134
+ /**
135
+ * Do not match directories, only files. (Note: to match
136
+ * _only_ directories, put a `/` at the end of the pattern.)
137
+ */
138
+ nodir?: boolean;
139
+ /**
140
+ * Do not match "extglob" patterns such as `+(a|b)`.
141
+ */
142
+ noext?: boolean;
143
+ /**
144
+ * Do not match `**` against multiple filenames. (Ie, treat it as a normal
145
+ * `*` instead.)
146
+ *
147
+ * Conflicts with {@link matchBase}
148
+ */
149
+ noglobstar?: boolean;
150
+ /**
151
+ * Defaults to value of `process.platform` if available, or `'linux'` if
152
+ * not. Setting `platform:'win32'` on non-Windows systems may cause strange
153
+ * behavior.
154
+ */
155
+ platform?: NodeJS.Platform;
156
+ /**
157
+ * Set to true to call `fs.realpath` on all of the
158
+ * results. In the case of an entry that cannot be resolved, the
159
+ * entry is omitted. This incurs a slight performance penalty, of
160
+ * course, because of the added system calls.
161
+ */
162
+ realpath?: boolean;
163
+ /**
164
+ *
165
+ * A string path resolved against the `cwd` option, which
166
+ * is used as the starting point for absolute patterns that start
167
+ * with `/`, (but not drive letters or UNC paths on Windows).
168
+ *
169
+ * Note that this _doesn't_ necessarily limit the walk to the
170
+ * `root` directory, and doesn't affect the cwd starting point for
171
+ * non-absolute patterns. A pattern containing `..` will still be
172
+ * able to traverse out of the root directory, if it is not an
173
+ * actual root directory on the filesystem, and any non-absolute
174
+ * patterns will be matched in the `cwd`. For example, the
175
+ * pattern `/../*` with `{root:'/some/path'}` will return all
176
+ * files in `/some`, not all files in `/some/path`. The pattern
177
+ * `*` with `{root:'/some/path'}` will return all the entries in
178
+ * the cwd, not the entries in `/some/path`.
179
+ *
180
+ * To start absolute and non-absolute patterns in the same
181
+ * path, you can use `{root:''}`. However, be aware that on
182
+ * Windows systems, a pattern like `x:/*` or `//host/share/*` will
183
+ * _always_ start in the `x:/` or `//host/share` directory,
184
+ * regardless of the `root` setting.
185
+ */
186
+ root?: string;
187
+ /**
188
+ * A [PathScurry](http://npm.im/path-scurry) object used
189
+ * to traverse the file system. If the `nocase` option is set
190
+ * explicitly, then any provided `scurry` object must match this
191
+ * setting.
192
+ */
193
+ scurry?: PathScurry;
194
+ /**
195
+ * Call `lstat()` on all entries, whether required or not to determine
196
+ * if it's a valid match. When used with {@link withFileTypes}, this means
197
+ * that matches will include data such as modified time, permissions, and
198
+ * so on. Note that this will incur a performance cost due to the added
199
+ * system calls.
200
+ */
201
+ stat?: boolean;
202
+ /**
203
+ * An AbortSignal which will cancel the Glob walk when
204
+ * triggered.
205
+ */
206
+ signal?: AbortSignal;
207
+ /**
208
+ * Use `\\` as a path separator _only_, and
209
+ * _never_ as an escape character. If set, all `\\` characters are
210
+ * replaced with `/` in the pattern.
211
+ *
212
+ * Note that this makes it **impossible** to match against paths
213
+ * containing literal glob pattern characters, but allows matching
214
+ * with patterns constructed using `path.join()` and
215
+ * `path.resolve()` on Windows platforms, mimicking the (buggy!)
216
+ * behavior of Glob v7 and before on Windows. Please use with
217
+ * caution, and be mindful of [the caveat below about Windows
218
+ * paths](#windows). (For legacy reasons, this is also set if
219
+ * `allowWindowsEscape` is set to the exact value `false`.)
220
+ */
221
+ windowsPathsNoEscape?: boolean;
222
+ /**
223
+ * Return [PathScurry](http://npm.im/path-scurry)
224
+ * `Path` objects instead of strings. These are similar to a
225
+ * NodeJS `Dirent` object, but with additional methods and
226
+ * properties.
227
+ *
228
+ * Conflicts with {@link absolute}
229
+ */
230
+ withFileTypes?: boolean;
231
+ /**
232
+ * An fs implementation to override some or all of the defaults. See
233
+ * http://npm.im/path-scurry for details about what can be overridden.
234
+ */
235
+ fs?: FSOption;
236
+ /**
237
+ * Just passed along to Minimatch. Note that this makes all pattern
238
+ * matching operations slower and *extremely* noisy.
239
+ */
240
+ debug?: boolean;
241
+ /**
242
+ * Return `/` delimited paths, even on Windows.
243
+ *
244
+ * On posix systems, this has no effect. But, on Windows, it means that
245
+ * paths will be `/` delimited, and absolute paths will be their full
246
+ * resolved UNC forms, eg instead of `'C:\\foo\\bar'`, it would return
247
+ * `'//?/C:/foo/bar'`
248
+ */
249
+ posix?: boolean;
250
+ }
251
+ export type GlobOptionsWithFileTypesTrue = GlobOptions & {
252
+ withFileTypes: true;
253
+ absolute?: undefined;
254
+ mark?: undefined;
255
+ posix?: undefined;
256
+ };
257
+ export type GlobOptionsWithFileTypesFalse = GlobOptions & {
258
+ withFileTypes?: false;
259
+ };
260
+ export type GlobOptionsWithFileTypesUnset = GlobOptions & {
261
+ withFileTypes?: undefined;
262
+ };
263
+ export type Result<Opts> = Opts extends GlobOptionsWithFileTypesTrue ? Path : Opts extends GlobOptionsWithFileTypesFalse ? string : Opts extends GlobOptionsWithFileTypesUnset ? string : string | Path;
264
+ export type Results<Opts> = Result<Opts>[];
265
+ export type FileTypes<Opts> = Opts extends GlobOptionsWithFileTypesTrue ? true : Opts extends GlobOptionsWithFileTypesFalse ? false : Opts extends GlobOptionsWithFileTypesUnset ? false : boolean;
266
+ /**
267
+ * An object that can perform glob pattern traversals.
268
+ */
269
+ export declare class Glob<Opts extends GlobOptions> implements GlobOptions {
270
+ absolute?: boolean;
271
+ cwd: string;
272
+ root?: string;
273
+ dot: boolean;
274
+ dotRelative: boolean;
275
+ follow: boolean;
276
+ ignore?: string | string[] | IgnoreLike;
277
+ magicalBraces: boolean;
278
+ mark?: boolean;
279
+ matchBase: boolean;
280
+ maxDepth: number;
281
+ nobrace: boolean;
282
+ nocase: boolean;
283
+ nodir: boolean;
284
+ noext: boolean;
285
+ noglobstar: boolean;
286
+ pattern: string[];
287
+ platform: NodeJS.Platform;
288
+ realpath: boolean;
289
+ scurry: PathScurry;
290
+ stat: boolean;
291
+ signal?: AbortSignal;
292
+ windowsPathsNoEscape: boolean;
293
+ withFileTypes: FileTypes<Opts>;
294
+ /**
295
+ * The options provided to the constructor.
296
+ */
297
+ opts: Opts;
298
+ /**
299
+ * An array of parsed immutable {@link Pattern} objects.
300
+ */
301
+ patterns: Pattern[];
302
+ /**
303
+ * All options are stored as properties on the `Glob` object.
304
+ *
305
+ * See {@link GlobOptions} for full options descriptions.
306
+ *
307
+ * Note that a previous `Glob` object can be passed as the
308
+ * `GlobOptions` to another `Glob` instantiation to re-use settings
309
+ * and caches with a new pattern.
310
+ *
311
+ * Traversal functions can be called multiple times to run the walk
312
+ * again.
313
+ */
314
+ constructor(pattern: string | string[], opts: Opts);
315
+ /**
316
+ * Returns a Promise that resolves to the results array.
317
+ */
318
+ walk(): Promise<Results<Opts>>;
319
+ /**
320
+ * synchronous {@link Glob.walk}
321
+ */
322
+ walkSync(): Results<Opts>;
323
+ /**
324
+ * Stream results asynchronously.
325
+ */
326
+ stream(): Minipass<Result<Opts>, Result<Opts>>;
327
+ /**
328
+ * Stream results synchronously.
329
+ */
330
+ streamSync(): Minipass<Result<Opts>, Result<Opts>>;
331
+ /**
332
+ * Default sync iteration function. Returns a Generator that
333
+ * iterates over the results.
334
+ */
335
+ iterateSync(): Generator<Result<Opts>, void, void>;
336
+ [Symbol.iterator](): Generator<Result<Opts>, void, void>;
337
+ /**
338
+ * Default async iteration function. Returns an AsyncGenerator that
339
+ * iterates over the results.
340
+ */
341
+ iterate(): AsyncGenerator<Result<Opts>, void, void>;
342
+ [Symbol.asyncIterator](): AsyncGenerator<Result<Opts>, void, void>;
343
+ }
344
+ //# sourceMappingURL=glob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/glob.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,WAAW,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EACL,QAAQ,EACR,IAAI,EACJ,UAAU,EAIX,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAGtC,MAAM,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;AACvC,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC,CAAA;AAWlE;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAE5B;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;IAElB;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IAEb;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IAErB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU,CAAA;IAEvC;;;;;OAKG;IACH,aAAa,CAAC,EAAE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AA;IACnB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAA;IACzB,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE,UAAU,CAAA;IAClB,IAAI,EAAE,OAAO,CAAA;IACb,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,oBAAoB,EAAE,OAAO,CAAA;IAC7B,aAAa,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;IAE9B;;OAEG;IACH,IAAI,EAAE,IAAI,CAAA;IAEV;;OAEG;IACH,QAAQ,EAAE,OAAO,EAAE,CAAA;IAEnB;;;;;;;;;;;OAWG;gBACS,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI;IAwHlD;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAmBpC;;OAEG;IACH,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAezB;;OAEG;IACH,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAa9C;;OAEG;IACH,UAAU,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAalD;;;OAGG;IACH,WAAW,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;IAGlD,CAAC,MAAM,CAAC,QAAQ,CAAC;IAIjB;;;OAGG;IACH,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;IAGnD,CAAC,MAAM,CAAC,aAAa,CAAC;CAGvB"}
@@ -0,0 +1,234 @@
1
+ import { Minimatch } from 'minimatch';
2
+ import { PathScurry, PathScurryDarwin, PathScurryPosix, PathScurryWin32, } from 'path-scurry';
3
+ import { fileURLToPath } from 'url';
4
+ import { Pattern } from './pattern.js';
5
+ import { GlobStream, GlobWalker } from './walker.js';
6
+ // if no process global, just call it linux.
7
+ // so we default to case-sensitive, / separators
8
+ const defaultPlatform = typeof process === 'object' &&
9
+ process &&
10
+ typeof process.platform === 'string'
11
+ ? process.platform
12
+ : 'linux';
13
+ /**
14
+ * An object that can perform glob pattern traversals.
15
+ */
16
+ export class Glob {
17
+ absolute;
18
+ cwd;
19
+ root;
20
+ dot;
21
+ dotRelative;
22
+ follow;
23
+ ignore;
24
+ magicalBraces;
25
+ mark;
26
+ matchBase;
27
+ maxDepth;
28
+ nobrace;
29
+ nocase;
30
+ nodir;
31
+ noext;
32
+ noglobstar;
33
+ pattern;
34
+ platform;
35
+ realpath;
36
+ scurry;
37
+ stat;
38
+ signal;
39
+ windowsPathsNoEscape;
40
+ withFileTypes;
41
+ /**
42
+ * The options provided to the constructor.
43
+ */
44
+ opts;
45
+ /**
46
+ * An array of parsed immutable {@link Pattern} objects.
47
+ */
48
+ patterns;
49
+ /**
50
+ * All options are stored as properties on the `Glob` object.
51
+ *
52
+ * See {@link GlobOptions} for full options descriptions.
53
+ *
54
+ * Note that a previous `Glob` object can be passed as the
55
+ * `GlobOptions` to another `Glob` instantiation to re-use settings
56
+ * and caches with a new pattern.
57
+ *
58
+ * Traversal functions can be called multiple times to run the walk
59
+ * again.
60
+ */
61
+ constructor(pattern, opts) {
62
+ /* c8 ignore start */
63
+ if (!opts)
64
+ throw new TypeError('glob options required');
65
+ /* c8 ignore stop */
66
+ this.withFileTypes = !!opts.withFileTypes;
67
+ this.signal = opts.signal;
68
+ this.follow = !!opts.follow;
69
+ this.dot = !!opts.dot;
70
+ this.dotRelative = !!opts.dotRelative;
71
+ this.nodir = !!opts.nodir;
72
+ this.mark = !!opts.mark;
73
+ if (!opts.cwd) {
74
+ this.cwd = '';
75
+ }
76
+ else if (opts.cwd instanceof URL || opts.cwd.startsWith('file://')) {
77
+ opts.cwd = fileURLToPath(opts.cwd);
78
+ }
79
+ this.cwd = opts.cwd || '';
80
+ this.root = opts.root;
81
+ this.magicalBraces = !!opts.magicalBraces;
82
+ this.nobrace = !!opts.nobrace;
83
+ this.noext = !!opts.noext;
84
+ this.realpath = !!opts.realpath;
85
+ this.absolute = opts.absolute;
86
+ this.noglobstar = !!opts.noglobstar;
87
+ this.matchBase = !!opts.matchBase;
88
+ this.maxDepth =
89
+ typeof opts.maxDepth === 'number' ? opts.maxDepth : Infinity;
90
+ this.stat = !!opts.stat;
91
+ this.ignore = opts.ignore;
92
+ if (this.withFileTypes && this.absolute !== undefined) {
93
+ throw new Error('cannot set absolute and withFileTypes:true');
94
+ }
95
+ if (typeof pattern === 'string') {
96
+ pattern = [pattern];
97
+ }
98
+ this.windowsPathsNoEscape =
99
+ !!opts.windowsPathsNoEscape ||
100
+ opts.allowWindowsEscape === false;
101
+ if (this.windowsPathsNoEscape) {
102
+ pattern = pattern.map(p => p.replace(/\\/g, '/'));
103
+ }
104
+ if (this.matchBase) {
105
+ if (opts.noglobstar) {
106
+ throw new TypeError('base matching requires globstar');
107
+ }
108
+ pattern = pattern.map(p => (p.includes('/') ? p : `./**/${p}`));
109
+ }
110
+ this.pattern = pattern;
111
+ this.platform = opts.platform || defaultPlatform;
112
+ this.opts = { ...opts, platform: this.platform };
113
+ if (opts.scurry) {
114
+ this.scurry = opts.scurry;
115
+ if (opts.nocase !== undefined &&
116
+ opts.nocase !== opts.scurry.nocase) {
117
+ throw new Error('nocase option contradicts provided scurry option');
118
+ }
119
+ }
120
+ else {
121
+ const Scurry = opts.platform === 'win32'
122
+ ? PathScurryWin32
123
+ : opts.platform === 'darwin'
124
+ ? PathScurryDarwin
125
+ : opts.platform
126
+ ? PathScurryPosix
127
+ : PathScurry;
128
+ this.scurry = new Scurry(this.cwd, {
129
+ nocase: opts.nocase,
130
+ fs: opts.fs,
131
+ });
132
+ }
133
+ this.nocase = this.scurry.nocase;
134
+ // If you do nocase:true on a case-sensitive file system, then
135
+ // we need to use regexps instead of strings for non-magic
136
+ // path portions, because statting `aBc` won't return results
137
+ // for the file `AbC` for example.
138
+ const nocaseMagicOnly = this.platform === 'darwin' || this.platform === 'win32';
139
+ const mmo = {
140
+ // default nocase based on platform
141
+ ...opts,
142
+ dot: this.dot,
143
+ matchBase: this.matchBase,
144
+ nobrace: this.nobrace,
145
+ nocase: this.nocase,
146
+ nocaseMagicOnly,
147
+ nocomment: true,
148
+ noext: this.noext,
149
+ nonegate: true,
150
+ optimizationLevel: 2,
151
+ platform: this.platform,
152
+ windowsPathsNoEscape: this.windowsPathsNoEscape,
153
+ debug: !!this.opts.debug,
154
+ };
155
+ const mms = this.pattern.map(p => new Minimatch(p, mmo));
156
+ const [matchSet, globParts] = mms.reduce((set, m) => {
157
+ set[0].push(...m.set);
158
+ set[1].push(...m.globParts);
159
+ return set;
160
+ }, [[], []]);
161
+ this.patterns = matchSet.map((set, i) => {
162
+ return new Pattern(set, globParts[i], 0, this.platform);
163
+ });
164
+ }
165
+ async walk() {
166
+ // Walkers always return array of Path objects, so we just have to
167
+ // coerce them into the right shape. It will have already called
168
+ // realpath() if the option was set to do so, so we know that's cached.
169
+ // start out knowing the cwd, at least
170
+ return [
171
+ ...(await new GlobWalker(this.patterns, this.scurry.cwd, {
172
+ ...this.opts,
173
+ maxDepth: this.maxDepth !== Infinity
174
+ ? this.maxDepth + this.scurry.cwd.depth()
175
+ : Infinity,
176
+ platform: this.platform,
177
+ nocase: this.nocase,
178
+ }).walk()),
179
+ ];
180
+ }
181
+ walkSync() {
182
+ return [
183
+ ...new GlobWalker(this.patterns, this.scurry.cwd, {
184
+ ...this.opts,
185
+ maxDepth: this.maxDepth !== Infinity
186
+ ? this.maxDepth + this.scurry.cwd.depth()
187
+ : Infinity,
188
+ platform: this.platform,
189
+ nocase: this.nocase,
190
+ }).walkSync(),
191
+ ];
192
+ }
193
+ stream() {
194
+ return new GlobStream(this.patterns, this.scurry.cwd, {
195
+ ...this.opts,
196
+ maxDepth: this.maxDepth !== Infinity
197
+ ? this.maxDepth + this.scurry.cwd.depth()
198
+ : Infinity,
199
+ platform: this.platform,
200
+ nocase: this.nocase,
201
+ }).stream();
202
+ }
203
+ streamSync() {
204
+ return new GlobStream(this.patterns, this.scurry.cwd, {
205
+ ...this.opts,
206
+ maxDepth: this.maxDepth !== Infinity
207
+ ? this.maxDepth + this.scurry.cwd.depth()
208
+ : Infinity,
209
+ platform: this.platform,
210
+ nocase: this.nocase,
211
+ }).streamSync();
212
+ }
213
+ /**
214
+ * Default sync iteration function. Returns a Generator that
215
+ * iterates over the results.
216
+ */
217
+ iterateSync() {
218
+ return this.streamSync()[Symbol.iterator]();
219
+ }
220
+ [Symbol.iterator]() {
221
+ return this.iterateSync();
222
+ }
223
+ /**
224
+ * Default async iteration function. Returns an AsyncGenerator that
225
+ * iterates over the results.
226
+ */
227
+ iterate() {
228
+ return this.stream()[Symbol.asyncIterator]();
229
+ }
230
+ [Symbol.asyncIterator]() {
231
+ return this.iterate();
232
+ }
233
+ }
234
+ //# sourceMappingURL=glob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/glob.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,WAAW,CAAA;AAEvD,OAAO,EAGL,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAKpD,4CAA4C;AAC5C,gDAAgD;AAChD,MAAM,eAAe,GACnB,OAAO,OAAO,KAAK,QAAQ;IAC3B,OAAO;IACP,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ;IAClC,CAAC,CAAC,OAAO,CAAC,QAAQ;IAClB,CAAC,CAAC,OAAO,CAAA;AAgTb;;GAEG;AACH,MAAM,O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,CAAC,WAAW,EAAE,CAAA;IAC3B,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAA;IAC9C,CAAC;IACD,CAAC,MAAM,CAAC,aAAa,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAA;IACvB,CAAC;CACF","sourcesContent":["import { Minimatch, MinimatchOptions } from 'minimatch'\nimport { Minipass } from 'minipass'\nimport {\n FSOption,\n Path,\n PathScurry,\n PathScurryDarwin,\n PathScurryPosix,\n PathScurryWin32,\n} from 'path-scurry'\nimport { fileURLToPath } from 'url'\nimport { IgnoreLike } from './ignore.js'\nimport { Pattern } from './pattern.js'\nimport { GlobStream, GlobWalker } from './walker.js'\n\nexport type MatchSet = Minimatch['set']\nexport type GlobParts = Exclude<Minimatch['globParts'], undefined>\n\n// if no process global, just call it linux.\n// so we default to case-sensitive, / separators\nconst defaultPlatform: NodeJS.Platform =\n typeof process === 'object' &&\n process &&\n typeof process.platform === 'string'\n ? process.platform\n : 'linux'\n\n/**\n * A `GlobOptions` object may be provided to any of the exported methods, and\n * must be provided to the `Glob` constructor.\n *\n * All options are optional, boolean, and false by default, unless otherwise\n * noted.\n *\n * All resolved options are added to the Glob object as properties.\n *\n * If you are running many `glob` operations, you can pass a Glob object as the\n * `options` argument to a subsequent operation to share the previously loaded\n * cache.\n */\nexport interface GlobOptions {\n /**\n * Set to `true` to always receive absolute paths for\n * matched files. Set to `false` to always return relative paths.\n *\n * When this option is not set, absolute paths are returned for patterns\n * that are absolute, and otherwise paths are returned that are relative\n * to the `cwd` setting.\n *\n * This does _not_ make an extra system call to get\n * the realpath, it only does string path resolution.\n *\n * Conflicts with {@link withFileTypes}\n */\n absolute?: boolean\n\n /**\n * Set to false to enable {@link windowsPathsNoEscape}\n *\n * @deprecated\n */\n allowWindowsEscape?: boolean\n\n /**\n * The current working directory in which to search. Defaults to\n * `process.cwd()`.\n *\n * May be eiher a string path or a `file://` URL object or string.\n */\n cwd?: string | URL\n\n /**\n * Include `.dot` files in normal matches and `globstar`\n * matches. Note that an explicit dot in a portion of the pattern\n * will always match dot files.\n */\n dot?: boolean\n\n /**\n * Prepend all relative path strings with `./` (or `.\\` on Windows).\n *\n * Without this option, returned relative paths are \"bare\", so instead of\n * returning `'./foo/bar'`, they are returned as `'foo/bar'`.\n *\n * Relative patterns starting with `'../'` are not prepended with `./`, even\n * if this option is set.\n */\n dotRelative?: boolean\n\n /**\n * Follow symlinked directories when expanding `**`\n * patterns. This can result in a lot of duplicate references in\n * the presence of cyclic links, and make performance quite bad.\n *\n * By default, a `**` in a pattern will follow 1 symbolic link if\n * it is not the first item in the pattern, or none if it is the\n * first item in the pattern, following the same behavior as Bash.\n */\n follow?: boolean\n\n /**\n * string or string[], or an object with `ignore` and `ignoreChildren`\n * methods.\n *\n * If a string or string[] is provided, then this is treated as a glob\n * pattern or array of glob patterns to exclude from matches. To ignore all\n * children within a directory, as well as the entry itself, append `'/**'`\n * to the ignore pattern.\n *\n * **Note** `ignore` patterns are _always_ in `dot:true` mode, regardless of\n * any other settings.\n *\n * If an object is provided that has `ignored(path)` and/or\n * `childrenIgnored(path)` methods, then these methods will be called to\n * determine whether any Path is a match or if its children should be\n * traversed, respectively.\n */\n ignore?: string | string[] | IgnoreLike\n\n /**\n * Treat brace expansion like `{a,b}` as a \"magic\" pattern. Has no\n * effect if {@link nobrace} is set.\n *\n * Only has effect on the {@link hasMagic} function.\n */\n magicalBraces?: boolean\n\n /**\n * Add a `/` character to directory matches. Note that this requires\n * additional stat calls in some cases.\n */\n mark?: boolean\n\n /**\n * Perform a basename-only match if the pattern does not contain any slash\n * characters. That is, `*.js` would be treated as equivalent to\n * `**\\/*.js`, matching all js files in all directories.\n */\n matchBase?: boolean\n\n /**\n * Limit the directory traversal to a given depth below the cwd.\n * Note that this does NOT prevent traversal to sibling folders,\n * root patterns, and so on. It only limits the maximum folder depth\n * that the walk will descend, relative to the cwd.\n */\n maxDepth?: number\n\n /**\n * Do not expand `{a,b}` and `{1..3}` brace sets.\n */\n nobrace?: boolean\n\n /**\n * Perform a case-insensitive match. This defaults to `true` on macOS and\n * Windows systems, and `false` on all others.\n *\n * **Note** `nocase` should only be explicitly set when it is\n * known that the filesystem's case sensitivity differs from the\n * platform default. If set `true` on case-sensitive file\n * systems, or `false` on case-insensitive file systems, then the\n * walk may return more or less results than expected.\n */\n nocase?: boolean\n\n /**\n * Do not match directories, only files. (Note: to match\n * _only_ directories, put a `/` at the end of the pattern.)\n */\n nodir?: boolean\n\n /**\n * Do not match \"extglob\" patterns such as `+(a|b)`.\n */\n noext?: boolean\n\n /**\n * Do not match `**` against multiple filenames. (Ie, treat it as a normal\n * `*` instead.)\n *\n * Conflicts with {@link matchBase}\n */\n noglobstar?: boolean\n\n /**\n * Defaults to value of `process.platform` if available, or `'linux'` if\n * not. Setting `platform:'win32'` on non-Windows systems may cause strange\n * behavior.\n */\n platform?: NodeJS.Platform\n\n /**\n * Set to true to call `fs.realpath` on all of the\n * results. In the case of an entry that cannot be resolved, the\n * entry is omitted. This incurs a slight performance penalty, of\n * course, because of the added system calls.\n */\n realpath?: boolean\n\n /**\n *\n * A string path resolved against the `cwd` option, which\n * is used as the starting point for absolute patterns that start\n * with `/`, (but not drive letters or UNC paths on Windows).\n *\n * Note that this _doesn't_ necessarily limit the walk to the\n * `root` directory, and doesn't affect the cwd starting point for\n * non-absolute patterns. A pattern containing `..` will still be\n * able to traverse out of the root directory, if it is not an\n * actual root directory on the filesystem, and any non-absolute\n * patterns will be matched in the `cwd`. For example, the\n * pattern `/../*` with `{root:'/some/path'}` will return all\n * files in `/some`, not all files in `/some/path`. The pattern\n * `*` with `{root:'/some/path'}` will return all the entries in\n * the cwd, not the entries in `/some/path`.\n *\n * To start absolute and non-absolute patterns in the same\n * path, you can use `{root:''}`. However, be aware that on\n * Windows systems, a pattern like `x:/*` or `//host/share/*` will\n * _always_ start in the `x:/` or `//host/share` directory,\n * regardless of the `root` setting.\n */\n root?: string\n\n /**\n * A [PathScurry](http://npm.im/path-scurry) object used\n * to traverse the file system. If the `nocase` option is set\n * explicitly, then any provided `scurry` object must match this\n * setting.\n */\n scurry?: PathScurry\n\n /**\n * Call `lstat()` on all entries, whether required or not to determine\n * if it's a valid match. When used with {@link withFileTypes}, this means\n * that matches will include data such as modified time, permissions, and\n * so on. Note that this will incur a performance cost due to the added\n * system calls.\n */\n stat?: boolean\n\n /**\n * An AbortSignal which will cancel the Glob walk when\n * triggered.\n */\n signal?: AbortSignal\n\n /**\n * Use `\\\\` as a path separator _only_, and\n * _never_ as an escape character. If set, all `\\\\` characters are\n * replaced with `/` in the pattern.\n *\n * Note that this makes it **impossible** to match against paths\n * containing literal glob pattern characters, but allows matching\n * with patterns constructed using `path.join()` and\n * `path.resolve()` on Windows platforms, mimicking the (buggy!)\n * behavior of Glob v7 and before on Windows. Please use with\n * caution, and be mindful of [the caveat below about Windows\n * paths](#windows). (For legacy reasons, this is also set if\n * `allowWindowsEscape` is set to the exact value `false`.)\n */\n windowsPathsNoEscape?: boolean\n\n /**\n * Return [PathScurry](http://npm.im/path-scurry)\n * `Path` objects instead of strings. These are similar to a\n * NodeJS `Dirent` object, but with additional methods and\n * properties.\n *\n * Conflicts with {@link absolute}\n */\n withFileTypes?: boolean\n\n /**\n * An fs implementation to override some or all of the defaults. See\n * http://npm.im/path-scurry for details about what can be overridden.\n */\n fs?: FSOption\n\n /**\n * Just passed along to Minimatch. Note that this makes all pattern\n * matching operations slower and *extremely* noisy.\n */\n debug?: boolean\n\n /**\n * Return `/` delimited paths, even on Windows.\n *\n * On posix systems, this has no effect. But, on Windows, it means that\n * paths will be `/` delimited, and absolute paths will be their full\n * resolved UNC forms, eg instead of `'C:\\\\foo\\\\bar'`, it would return\n * `'//?/C:/foo/bar'`\n */\n posix?: boolean\n}\n\nexport type GlobOptionsWithFileTypesTrue = GlobOptions & {\n withFileTypes: true\n // string options not relevant if returning Path objects.\n absolute?: undefined\n mark?: undefined\n posix?: undefined\n}\n\nexport type GlobOptionsWithFileTypesFalse = GlobOptions & {\n withFileTypes?: false\n}\n\nexport type GlobOptionsWithFileTypesUnset = GlobOptions & {\n withFileTypes?: undefined\n}\n\nexport type Result<Opts> = Opts extends GlobOptionsWithFileTypesTrue\n ? Path\n : Opts extends GlobOptionsWithFileTypesFalse\n ? string\n : Opts extends GlobOptionsWithFileTypesUnset\n ? string\n : string | Path\nexport type Results<Opts> = Result<Opts>[]\n\nexport type FileTypes<Opts> = Opts extends GlobOptionsWithFileTypesTrue\n ? true\n : Opts extends GlobOptionsWithFileTypesFalse\n ? false\n : Opts extends GlobOptionsWithFileTypesUnset\n ? false\n : boolean\n\n/**\n * An object that can perform glob pattern traversals.\n */\nexport class Glob<Opts extends GlobOptions> implements GlobOptions {\n absolute?: boolean\n cwd: string\n root?: string\n dot: boolean\n dotRelative: boolean\n follow: boolean\n ignore?: string | string[] | IgnoreLike\n magicalBraces: boolean\n mark?: boolean\n matchBase: boolean\n maxDepth: number\n nobrace: boolean\n nocase: boolean\n nodir: boolean\n noext: boolean\n noglobstar: boolean\n pattern: string[]\n platform: NodeJS.Platform\n realpath: boolean\n scurry: PathScurry\n stat: boolean\n signal?: AbortSignal\n windowsPathsNoEscape: boolean\n withFileTypes: FileTypes<Opts>\n\n /**\n * The options provided to the constructor.\n */\n opts: Opts\n\n /**\n * An array of parsed immutable {@link Pattern} objects.\n */\n patterns: Pattern[]\n\n /**\n * All options are stored as properties on the `Glob` object.\n *\n * See {@link GlobOptions} for full options descriptions.\n *\n * Note that a previous `Glob` object can be passed as the\n * `GlobOptions` to another `Glob` instantiation to re-use settings\n * and caches with a new pattern.\n *\n * Traversal functions can be called multiple times to run the walk\n * again.\n */\n constructor(pattern: string | string[], opts: Opts) {\n /* c8 ignore start */\n if (!opts) throw new TypeError('glob options required')\n /* c8 ignore stop */\n this.withFileTypes = !!opts.withFileTypes as FileTypes<Opts>\n this.signal = opts.signal\n this.follow = !!opts.follow\n this.dot = !!opts.dot\n this.dotRelative = !!opts.dotRelative\n this.nodir = !!opts.nodir\n this.mark = !!opts.mark\n if (!opts.cwd) {\n this.cwd = ''\n } else if (opts.cwd instanceof URL || opts.cwd.startsWith('file://')) {\n opts.cwd = fileURLToPath(opts.cwd)\n }\n this.cwd = opts.cwd || ''\n this.root = opts.root\n this.magicalBraces = !!opts.magicalBraces\n this.nobrace = !!opts.nobrace\n this.noext = !!opts.noext\n this.realpath = !!opts.realpath\n this.absolute = opts.absolute\n\n this.noglobstar = !!opts.noglobstar\n this.matchBase = !!opts.matchBase\n this.maxDepth =\n typeof opts.maxDepth === 'number' ? opts.maxDepth : Infinity\n this.stat = !!opts.stat\n this.ignore = opts.ignore\n\n if (this.withFileTypes && this.absolute !== undefined) {\n throw new Error('cannot set absolute and withFileTypes:true')\n }\n\n if (typeof pattern === 'string') {\n pattern = [pattern]\n }\n\n this.windowsPathsNoEscape =\n !!opts.windowsPathsNoEscape ||\n (opts as GlobOptions).allowWindowsEscape === false\n\n if (this.windowsPathsNoEscape) {\n pattern = pattern.map(p => p.replace(/\\\\/g, '/'))\n }\n\n if (this.matchBase) {\n if (opts.noglobstar) {\n throw new TypeError('base matching requires globstar')\n }\n pattern = pattern.map(p => (p.includes('/') ? p : `./**/${p}`))\n }\n\n this.pattern = pattern\n\n this.platform = opts.platform || defaultPlatform\n this.opts = { ...opts, platform: this.platform }\n if (opts.scurry) {\n this.scurry = opts.scurry\n if (\n opts.nocase !== undefined &&\n opts.nocase !== opts.scurry.nocase\n ) {\n throw new Error('nocase option contradicts provided scurry option')\n }\n } else {\n const Scurry =\n opts.platform === 'win32'\n ? PathScurryWin32\n : opts.platform === 'darwin'\n ? PathScurryDarwin\n : opts.platform\n ? PathScurryPosix\n : PathScurry\n this.scurry = new Scurry(this.cwd, {\n nocase: opts.nocase,\n fs: opts.fs,\n })\n }\n this.nocase = this.scurry.nocase\n\n // If you do nocase:true on a case-sensitive file system, then\n // we need to use regexps instead of strings for non-magic\n // path portions, because statting `aBc` won't return results\n // for the file `AbC` for example.\n const nocaseMagicOnly =\n this.platform === 'darwin' || this.platform === 'win32'\n\n const mmo: MinimatchOptions = {\n // default nocase based on platform\n ...opts,\n dot: this.dot,\n matchBase: this.matchBase,\n nobrace: this.nobrace,\n nocase: this.nocase,\n nocaseMagicOnly,\n nocomment: true,\n noext: this.noext,\n nonegate: true,\n optimizationLevel: 2,\n platform: this.platform,\n windowsPathsNoEscape: this.windowsPathsNoEscape,\n debug: !!this.opts.debug,\n }\n\n const mms = this.pattern.map(p => new Minimatch(p, mmo))\n const [matchSet, globParts] = mms.reduce(\n (set: [MatchSet, GlobParts], m) => {\n set[0].push(...m.set)\n set[1].push(...m.globParts)\n return set\n },\n [[], []]\n )\n this.patterns = matchSet.map((set, i) => {\n return new Pattern(set, globParts[i], 0, this.platform)\n })\n }\n\n /**\n * Returns a Promise that resolves to the results array.\n */\n async walk(): Promise<Results<Opts>>\n async walk(): Promise<(string | Path)[]> {\n // Walkers always return array of Path objects, so we just have to\n // coerce them into the right shape. It will have already called\n // realpath() if the option was set to do so, so we know that's cached.\n // start out knowing the cwd, at least\n return [\n ...(await new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).walk()),\n ]\n }\n\n /**\n * synchronous {@link Glob.walk}\n */\n walkSync(): Results<Opts>\n walkSync(): (string | Path)[] {\n return [\n ...new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).walkSync(),\n ]\n }\n\n /**\n * Stream results asynchronously.\n */\n stream(): Minipass<Result<Opts>, Result<Opts>>\n stream(): Minipass<string | Path, string | Path> {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).stream()\n }\n\n /**\n * Stream results synchronously.\n */\n streamSync(): Minipass<Result<Opts>, Result<Opts>>\n streamSync(): Minipass<string | Path, string | Path> {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).streamSync()\n }\n\n /**\n * Default sync iteration function. Returns a Generator that\n * iterates over the results.\n */\n iterateSync(): Generator<Result<Opts>, void, void> {\n return this.streamSync()[Symbol.iterator]()\n }\n [Symbol.iterator]() {\n return this.iterateSync()\n }\n\n /**\n * Default async iteration function. Returns an AsyncGenerator that\n * iterates over the results.\n */\n iterate(): AsyncGenerator<Result<Opts>, void, void> {\n return this.stream()[Symbol.asyncIterator]()\n }\n [Symbol.asyncIterator]() {\n return this.iterate()\n }\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { GlobOptions } from './glob.js';
2
+ /**
3
+ * Return true if the patterns provided contain any magic glob characters,
4
+ * given the options provided.
5
+ *
6
+ * Brace expansion is not considered "magic" unless the `magicalBraces` option
7
+ * is set, as brace expansion just turns one string into an array of strings.
8
+ * So a pattern like `'x{a,b}y'` would return `false`, because `'xay'` and
9
+ * `'xby'` both do not contain any magic glob characters, and it's treated the
10
+ * same as if you had called it on `['xay', 'xby']`. When `magicalBraces:true`
11
+ * is in the options, brace expansion _is_ treated as a pattern having magic.
12
+ */
13
+ export declare const hasMagic: (pattern: string | string[], options?: GlobOptions) => boolean;
14
+ //# sourceMappingURL=has-magic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-magic.d.ts","sourceRoot":"","sources":["../../src/has-magic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,YACV,MAAM,GAAG,MAAM,EAAE,YACjB,WAAW,KACnB,OAQF,CAAA"}