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,23 @@
1
+ import { Minimatch } from 'minimatch';
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 const hasMagic = (pattern, options = {}) => {
14
+ if (!Array.isArray(pattern)) {
15
+ pattern = [pattern];
16
+ }
17
+ for (const p of pattern) {
18
+ if (new Minimatch(p, options).hasMagic())
19
+ return true;
20
+ }
21
+ return false;
22
+ };
23
+ //# sourceMappingURL=has-magic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-magic.js","sourceRoot":"","sources":["../../src/has-magic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAGrC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,OAA0B,EAC1B,UAAuB,EAAE,EAChB,EAAE;IACX,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC3B,OAAO,GAAG,CAAC,OAAO,CAAC,CAAA;KACpB;IACD,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE;QACvB,IAAI,IAAI,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE;YAAE,OAAO,IAAI,CAAA;KACtD;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { Minimatch } from 'minimatch'\nimport { GlobOptions } from './glob.js'\n\n/**\n * Return true if the patterns provided contain any magic glob characters,\n * given the options provided.\n *\n * Brace expansion is not considered \"magic\" unless the `magicalBraces` option\n * is set, as brace expansion just turns one string into an array of strings.\n * So a pattern like `'x{a,b}y'` would return `false`, because `'xay'` and\n * `'xby'` both do not contain any magic glob characters, and it's treated the\n * same as if you had called it on `['xay', 'xby']`. When `magicalBraces:true`\n * is in the options, brace expansion _is_ treated as a pattern having magic.\n */\nexport const hasMagic = (\n pattern: string | string[],\n options: GlobOptions = {}\n): boolean => {\n if (!Array.isArray(pattern)) {\n pattern = [pattern]\n }\n for (const p of pattern) {\n if (new Minimatch(p, options).hasMagic()) return true\n }\n return false\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import { Minimatch } from 'minimatch';
2
+ import { Path } from 'path-scurry';
3
+ import { GlobWalkerOpts } from './walker.js';
4
+ export interface IgnoreLike {
5
+ ignored?: (p: Path) => boolean;
6
+ childrenIgnored?: (p: Path) => boolean;
7
+ }
8
+ /**
9
+ * Class used to process ignored patterns
10
+ */
11
+ export declare class Ignore implements IgnoreLike {
12
+ relative: Minimatch[];
13
+ relativeChildren: Minimatch[];
14
+ absolute: Minimatch[];
15
+ absoluteChildren: Minimatch[];
16
+ constructor(ignored: string[], { nobrace, nocase, noext, noglobstar, platform, }: GlobWalkerOpts);
17
+ ignored(p: Path): boolean;
18
+ childrenIgnored(p: Path): boolean;
19
+ }
20
+ //# sourceMappingURL=ignore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ignore.d.ts","sourceRoot":"","sources":["../../src/ignore.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,OAAO,CAAA;IAC9B,eAAe,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,OAAO,CAAA;CACvC;AASD;;GAEG;AACH,qBAAa,MAAO,YAAW,UAAU;IACvC,QAAQ,EAAE,SAAS,EAAE,CAAA;IACrB,gBAAgB,EAAE,SAAS,EAAE,CAAA;IAC7B,QAAQ,EAAE,SAAS,EAAE,CAAA;IACrB,gBAAgB,EAAE,SAAS,EAAE,CAAA;gBAG3B,OAAO,EAAE,MAAM,EAAE,EACjB,EACE,OAAO,EACP,MAAM,EACN,KAAK,EACL,UAAU,EACV,QAA0B,GAC3B,EAAE,cAAc;IAiDnB,OAAO,CAAC,CAAC,EAAE,IAAI,GAAG,OAAO;IAczB,eAAe,CAAC,CAAC,EAAE,IAAI,GAAG,OAAO;CAWlC"}
@@ -0,0 +1,99 @@
1
+ // give it a pattern, and it'll be able to tell you if
2
+ // a given path should be ignored.
3
+ // Ignoring a path ignores its children if the pattern ends in /**
4
+ // Ignores are always parsed in dot:true mode
5
+ import { Minimatch } from 'minimatch';
6
+ import { Pattern } from './pattern.js';
7
+ const defaultPlatform = typeof process === 'object' &&
8
+ process &&
9
+ typeof process.platform === 'string'
10
+ ? process.platform
11
+ : 'linux';
12
+ /**
13
+ * Class used to process ignored patterns
14
+ */
15
+ export class Ignore {
16
+ relative;
17
+ relativeChildren;
18
+ absolute;
19
+ absoluteChildren;
20
+ constructor(ignored, { nobrace, nocase, noext, noglobstar, platform = defaultPlatform, }) {
21
+ this.relative = [];
22
+ this.absolute = [];
23
+ this.relativeChildren = [];
24
+ this.absoluteChildren = [];
25
+ const mmopts = {
26
+ dot: true,
27
+ nobrace,
28
+ nocase,
29
+ noext,
30
+ noglobstar,
31
+ optimizationLevel: 2,
32
+ platform,
33
+ nocomment: true,
34
+ nonegate: true,
35
+ };
36
+ // this is a little weird, but it gives us a clean set of optimized
37
+ // minimatch matchers, without getting tripped up if one of them
38
+ // ends in /** inside a brace section, and it's only inefficient at
39
+ // the start of the walk, not along it.
40
+ // It'd be nice if the Pattern class just had a .test() method, but
41
+ // handling globstars is a bit of a pita, and that code already lives
42
+ // in minimatch anyway.
43
+ // Another way would be if maybe Minimatch could take its set/globParts
44
+ // as an option, and then we could at least just use Pattern to test
45
+ // for absolute-ness.
46
+ // Yet another way, Minimatch could take an array of glob strings, and
47
+ // a cwd option, and do the right thing.
48
+ for (const ign of ignored) {
49
+ const mm = new Minimatch(ign, mmopts);
50
+ for (let i = 0; i < mm.set.length; i++) {
51
+ const parsed = mm.set[i];
52
+ const globParts = mm.globParts[i];
53
+ const p = new Pattern(parsed, globParts, 0, platform);
54
+ const m = new Minimatch(p.globString(), mmopts);
55
+ const children = globParts[globParts.length - 1] === '**';
56
+ const absolute = p.isAbsolute();
57
+ if (absolute)
58
+ this.absolute.push(m);
59
+ else
60
+ this.relative.push(m);
61
+ if (children) {
62
+ if (absolute)
63
+ this.absoluteChildren.push(m);
64
+ else
65
+ this.relativeChildren.push(m);
66
+ }
67
+ }
68
+ }
69
+ }
70
+ ignored(p) {
71
+ const fullpath = p.fullpath();
72
+ const fullpaths = `${fullpath}/`;
73
+ const relative = p.relative() || '.';
74
+ const relatives = `${relative}/`;
75
+ for (const m of this.relative) {
76
+ if (m.match(relative) || m.match(relatives))
77
+ return true;
78
+ }
79
+ for (const m of this.absolute) {
80
+ if (m.match(fullpath) || m.match(fullpaths))
81
+ return true;
82
+ }
83
+ return false;
84
+ }
85
+ childrenIgnored(p) {
86
+ const fullpath = p.fullpath() + '/';
87
+ const relative = (p.relative() || '.') + '/';
88
+ for (const m of this.relativeChildren) {
89
+ if (m.match(relative))
90
+ return true;
91
+ }
92
+ for (const m of this.absoluteChildren) {
93
+ if (m.match(fullpath))
94
+ true;
95
+ }
96
+ return false;
97
+ }
98
+ }
99
+ //# sourceMappingURL=ignore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ignore.js","sourceRoot":"","sources":["../../src/ignore.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,kCAAkC;AAClC,kEAAkE;AAClE,6CAA6C;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAQtC,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;AAEb;;GAEG;AACH,MAAM,OAAO,MAAM;IACjB,QAAQ,CAAa;IACrB,gBAAgB,CAAa;IAC7B,QAAQ,CAAa;IACrB,gBAAgB,CAAa;IAE7B,YACE,OAAiB,EACjB,EACE,OAAO,EACP,MAAM,EACN,KAAK,EACL,UAAU,EACV,QAAQ,GAAG,eAAe,GACX;QAEjB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAA;QAClB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAA;QAClB,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAA;QAC1B,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAA;QAC1B,MAAM,MAAM,GAAG;YACb,GAAG,EAAE,IAAI;YACT,OAAO;YACP,MAAM;YACN,KAAK;YACL,UAAU;YACV,iBAAiB,EAAE,CAAC;YACpB,QAAQ;YACR,SAAS,EAAE,IAAI;YACf,QAAQ,EAAE,IAAI;SACf,CAAA;QAED,mEAAmE;QACnE,gEAAgE;QAChE,mEAAmE;QACnE,uCAAuC;QACvC,mEAAmE;QACnE,qEAAqE;QACrE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AAG,GAAG,QAAQ,GAAG,CAAA;QAChC,MAAM,QAAQ,GAAG,CAAC,CAAC,QAAQ,EAAE,IAAI,GAAG,CAAA;QACpC,MAAM,SAAS,GAAG,GAAG,QAAQ,GAAG,CAAA;QAChC,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE;YAC7B,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC;gBAAE,OAAO,IAAI,CAAA;SACzD;QACD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE;YAC7B,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC;gBAAE,OAAO,IAAI,CAAA;SACzD;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,eAAe,CAAC,CAAO;QACrB,MAAM,QAAQ,GAAG,CAAC,CAAC,QAAQ,EAAE,GAAG,GAAG,CAAA;QACnC,MAAM,QAAQ,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,GAAG,CAAC,GAAG,GAAG,CAAA;QAC5C,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACrC,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;gBAAE,OAAO,IAAI,CAAA;SACnC;QACD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACrC,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;gBAAE,IAAI,CAAA;SAC5B;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF","sourcesContent":["// give it a pattern, and it'll be able to tell you if\n// a given path should be ignored.\n// Ignoring a path ignores its children if the pattern ends in /**\n// Ignores are always parsed in dot:true mode\n\nimport { Minimatch } from 'minimatch'\nimport { Path } from 'path-scurry'\nimport { Pattern } from './pattern.js'\nimport { GlobWalkerOpts } from './walker.js'\n\nexport interface IgnoreLike {\n ignored?: (p: Path) => boolean\n childrenIgnored?: (p: Path) => boolean\n}\n\nconst defaultPlatform: NodeJS.Platform =\n typeof process === 'object' &&\n process &&\n typeof process.platform === 'string'\n ? process.platform\n : 'linux'\n\n/**\n * Class used to process ignored patterns\n */\nexport class Ignore implements IgnoreLike {\n relative: Minimatch[]\n relativeChildren: Minimatch[]\n absolute: Minimatch[]\n absoluteChildren: Minimatch[]\n\n constructor(\n ignored: string[],\n {\n nobrace,\n nocase,\n noext,\n noglobstar,\n platform = defaultPlatform,\n }: GlobWalkerOpts\n ) {\n this.relative = []\n this.absolute = []\n this.relativeChildren = []\n this.absoluteChildren = []\n const mmopts = {\n dot: true,\n nobrace,\n nocase,\n noext,\n noglobstar,\n optimizationLevel: 2,\n platform,\n nocomment: true,\n nonegate: true,\n }\n\n // this is a little weird, but it gives us a clean set of optimized\n // minimatch matchers, without getting tripped up if one of them\n // ends in /** inside a brace section, and it's only inefficient at\n // the start of the walk, not along it.\n // It'd be nice if the Pattern class just had a .test() method, but\n // handling globstars is a bit of a pita, and that code already lives\n // in minimatch anyway.\n // Another way would be if maybe Minimatch could take its set/globParts\n // as an option, and then we could at least just use Pattern to test\n // for absolute-ness.\n // Yet another way, Minimatch could take an array of glob strings, and\n // a cwd option, and do the right thing.\n for (const ign of ignored) {\n const mm = new Minimatch(ign, mmopts)\n for (let i = 0; i < mm.set.length; i++) {\n const parsed = mm.set[i]\n const globParts = mm.globParts[i]\n const p = new Pattern(parsed, globParts, 0, platform)\n const m = new Minimatch(p.globString(), mmopts)\n const children = globParts[globParts.length - 1] === '**'\n const absolute = p.isAbsolute()\n if (absolute) this.absolute.push(m)\n else this.relative.push(m)\n if (children) {\n if (absolute) this.absoluteChildren.push(m)\n else this.relativeChildren.push(m)\n }\n }\n }\n }\n\n ignored(p: Path): boolean {\n const fullpath = p.fullpath()\n const fullpaths = `${fullpath}/`\n const relative = p.relative() || '.'\n const relatives = `${relative}/`\n for (const m of this.relative) {\n if (m.match(relative) || m.match(relatives)) return true\n }\n for (const m of this.absolute) {\n if (m.match(fullpath) || m.match(fullpaths)) return true\n }\n return false\n }\n\n childrenIgnored(p: Path): boolean {\n const fullpath = p.fullpath() + '/'\n const relative = (p.relative() || '.') + '/'\n for (const m of this.relativeChildren) {\n if (m.match(relative)) return true\n }\n for (const m of this.absoluteChildren) {\n if (m.match(fullpath)) true\n }\n return false\n }\n}\n"]}
@@ -0,0 +1,95 @@
1
+ import { Minipass } from 'minipass';
2
+ import { Path } from 'path-scurry';
3
+ import type { GlobOptions, GlobOptionsWithFileTypesFalse, GlobOptionsWithFileTypesTrue, GlobOptionsWithFileTypesUnset } from './glob.js';
4
+ import { Glob } from './glob.js';
5
+ /**
6
+ * Syncronous form of {@link globStream}. Will read all the matches as fast as
7
+ * you consume them, even all in a single tick if you consume them immediately,
8
+ * but will still respond to backpressure if they're not consumed immediately.
9
+ */
10
+ export declare function globStreamSync(pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Minipass<Path, Path>;
11
+ export declare function globStreamSync(pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Minipass<string, string>;
12
+ export declare function globStreamSync(pattern: string | string[], options: GlobOptionsWithFileTypesUnset): Minipass<string, string>;
13
+ export declare function globStreamSync(pattern: string | string[], options: GlobOptions): Minipass<Path, Path> | Minipass<string, string>;
14
+ /**
15
+ * Return a stream that emits all the strings or `Path` objects and
16
+ * then emits `end` when completed.
17
+ */
18
+ export declare function globStream(pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Minipass<string, string>;
19
+ export declare function globStream(pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Minipass<Path, Path>;
20
+ export declare function globStream(pattern: string | string[], options?: GlobOptionsWithFileTypesUnset | undefined): Minipass<string, string>;
21
+ export declare function globStream(pattern: string | string[], options: GlobOptions): Minipass<Path, Path> | Minipass<string, string>;
22
+ /**
23
+ * Synchronous form of {@link glob}
24
+ */
25
+ export declare function globSync(pattern: string | string[], options: GlobOptionsWithFileTypesFalse): string[];
26
+ export declare function globSync(pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Path[];
27
+ export declare function globSync(pattern: string | string[], options?: GlobOptionsWithFileTypesUnset | undefined): string[];
28
+ export declare function globSync(pattern: string | string[], options: GlobOptions): Path[] | string[];
29
+ /**
30
+ * Perform an asynchronous glob search for the pattern(s) specified. Returns
31
+ * [Path](https://isaacs.github.io/path-scurry/classes/PathBase) objects if the
32
+ * {@link withFileTypes} option is set to `true`. See {@link GlobOptions} for
33
+ * full option descriptions.
34
+ */
35
+ declare function glob_(pattern: string | string[], options?: GlobOptionsWithFileTypesUnset | undefined): Promise<string[]>;
36
+ declare function glob_(pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Promise<Path[]>;
37
+ declare function glob_(pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Promise<string[]>;
38
+ declare function glob_(pattern: string | string[], options: GlobOptions): Promise<Path[] | string[]>;
39
+ /**
40
+ * Return a sync iterator for walking glob pattern matches.
41
+ */
42
+ export declare function globIterateSync(pattern: string | string[], options?: GlobOptionsWithFileTypesUnset | undefined): Generator<string, void, void>;
43
+ export declare function globIterateSync(pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Generator<Path, void, void>;
44
+ export declare function globIterateSync(pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Generator<string, void, void>;
45
+ export declare function globIterateSync(pattern: string | string[], options: GlobOptions): Generator<Path, void, void> | Generator<string, void, void>;
46
+ /**
47
+ * Return an async iterator for walking glob pattern matches.
48
+ */
49
+ export declare function globIterate(pattern: string | string[], options?: GlobOptionsWithFileTypesUnset | undefined): AsyncGenerator<string, void, void>;
50
+ export declare function globIterate(pattern: string | string[], options: GlobOptionsWithFileTypesTrue): AsyncGenerator<Path, void, void>;
51
+ export declare function globIterate(pattern: string | string[], options: GlobOptionsWithFileTypesFalse): AsyncGenerator<string, void, void>;
52
+ export declare function globIterate(pattern: string | string[], options: GlobOptions): AsyncGenerator<Path, void, void> | AsyncGenerator<string, void, void>;
53
+ export declare const streamSync: typeof globStreamSync;
54
+ export declare const stream: typeof globStream & {
55
+ sync: typeof globStreamSync;
56
+ };
57
+ export declare const iterateSync: typeof globIterateSync;
58
+ export declare const iterate: typeof globIterate & {
59
+ sync: typeof globIterateSync;
60
+ };
61
+ export declare const sync: typeof globSync & {
62
+ stream: typeof globStreamSync;
63
+ iterate: typeof globIterateSync;
64
+ };
65
+ export { escape, unescape } from 'minimatch';
66
+ export { Glob } from './glob.js';
67
+ export type { GlobOptions, GlobOptionsWithFileTypesFalse, GlobOptionsWithFileTypesTrue, GlobOptionsWithFileTypesUnset, } from './glob.js';
68
+ export { hasMagic } from './has-magic.js';
69
+ export type { IgnoreLike } from './ignore.js';
70
+ export type { MatchStream } from './walker.js';
71
+ export declare const glob: typeof glob_ & {
72
+ glob: typeof glob_;
73
+ globSync: typeof globSync;
74
+ sync: typeof globSync & {
75
+ stream: typeof globStreamSync;
76
+ iterate: typeof globIterateSync;
77
+ };
78
+ globStream: typeof globStream;
79
+ stream: typeof globStream & {
80
+ sync: typeof globStreamSync;
81
+ };
82
+ globStreamSync: typeof globStreamSync;
83
+ streamSync: typeof globStreamSync;
84
+ globIterate: typeof globIterate;
85
+ iterate: typeof globIterate & {
86
+ sync: typeof globIterateSync;
87
+ };
88
+ globIterateSync: typeof globIterateSync;
89
+ iterateSync: typeof globIterateSync;
90
+ Glob: typeof Glob;
91
+ hasMagic: (pattern: string | string[], options?: GlobOptions) => boolean;
92
+ escape: (s: string, { windowsPathsNoEscape, }?: Pick<import("minimatch").MinimatchOptions, "windowsPathsNoEscape"> | undefined) => string;
93
+ unescape: (s: string, { windowsPathsNoEscape, }?: Pick<import("minimatch").MinimatchOptions, "windowsPathsNoEscape"> | undefined) => string;
94
+ };
95
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,E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AE,IAAI,EAAE,IAAI,CAAC,CAAA;AACrC,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,OAAO,EAAE,WAAW,GACnB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AASxE,eAAO,MAAM,UAAU,uBAAiB,CAAA;AACxC,eAAO,MAAM,MAAM;;CAAsD,CAAA;AACzE,eAAO,MAAM,WAAW,wBAAkB,CAAA;AAC1C,eAAO,MAAM,OAAO;;CAElB,CAAA;AACF,eAAO,MAAM,IAAI;;;CAGf,CAAA;AAGF,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,YAAY,EACV,WAAW,EACX,6BAA6B,EAC7B,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAG9C,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;CAgBf,CAAA"}
@@ -0,0 +1,56 @@
1
+ import { escape, unescape } from 'minimatch';
2
+ import { Glob } from './glob.js';
3
+ import { hasMagic } from './has-magic.js';
4
+ export function globStreamSync(pattern, options = {}) {
5
+ return new Glob(pattern, options).streamSync();
6
+ }
7
+ export function globStream(pattern, options = {}) {
8
+ return new Glob(pattern, options).stream();
9
+ }
10
+ export function globSync(pattern, options = {}) {
11
+ return new Glob(pattern, options).walkSync();
12
+ }
13
+ async function glob_(pattern, options = {}) {
14
+ return new Glob(pattern, options).walk();
15
+ }
16
+ export function globIterateSync(pattern, options = {}) {
17
+ return new Glob(pattern, options).iterateSync();
18
+ }
19
+ export function globIterate(pattern, options = {}) {
20
+ return new Glob(pattern, options).iterate();
21
+ }
22
+ // aliases: glob.sync.stream() glob.stream.sync() glob.sync() etc
23
+ export const streamSync = globStreamSync;
24
+ export const stream = Object.assign(globStream, { sync: globStreamSync });
25
+ export const iterateSync = globIterateSync;
26
+ export const iterate = Object.assign(globIterate, {
27
+ sync: globIterateSync,
28
+ });
29
+ export const sync = Object.assign(globSync, {
30
+ stream: globStreamSync,
31
+ iterate: globIterateSync,
32
+ });
33
+ /* c8 ignore start */
34
+ export { escape, unescape } from 'minimatch';
35
+ export { Glob } from './glob.js';
36
+ export { hasMagic } from './has-magic.js';
37
+ /* c8 ignore stop */
38
+ export const glob = Object.assign(glob_, {
39
+ glob: glob_,
40
+ globSync,
41
+ sync,
42
+ globStream,
43
+ stream,
44
+ globStreamSync,
45
+ streamSync,
46
+ globIterate,
47
+ iterate,
48
+ globIterateSync,
49
+ iterateSync,
50
+ Glob,
51
+ hasMagic,
52
+ escape,
53
+ unescape,
54
+ });
55
+ glob.glob = glob;
56
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAS5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAuBzC,MAAM,UAAU,cAAc,CAC5B,OAA0B,EAC1B,UAAuB,EAAE;IAEzB,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,UAAU,EAAE,CAAA;AAChD,CAAC;AAsBD,MAAM,UAAU,UAAU,CACxB,OAA0B,EAC1B,UAAuB,EAAE;IAEzB,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,CAAA;AAC5C,CAAC;AAqBD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,EAAE,MAAM,gBAAgB,CAAA;AAGzC,oBAAoB;AAEpB,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;IACvC,IAAI,EAAE,KAAK;IACX,QAAQ;IACR,IAAI;IACJ,UAAU;IACV,MAAM;IACN,cAAc;IACd,UAAU;IACV,WAAW;IACX,OAAO;IACP,eAAe;IACf,WAAW;IACX,IAAI;IACJ,QAAQ;IACR,MAAM;IACN,QAAQ;CACT,CAAC,CAAA;AACF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA","sourcesContent":["import { escape, unescape } from 'minimatch'\nimport { Minipass } from 'minipass'\nimport { Path } from 'path-scurry'\nimport type {\n GlobOptions,\n GlobOptionsWithFileTypesFalse,\n GlobOptionsWithFileTypesTrue,\n GlobOptionsWithFileTypesUnset,\n} from './glob.js'\nimport { Glob } from './glob.js'\nimport { hasMagic } from './has-magic.js'\n\n/**\n * Syncronous form of {@link globStream}. Will read all the matches as fast as\n * you consume them, even all in a single tick if you consume them immediately,\n * but will still respond to backpressure if they're not consumed immediately.\n */\nexport function globStreamSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesTrue\n): Minipass<Path, Path>\nexport function globStreamSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesFalse\n): Minipass<string, string>\nexport function globStreamSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesUnset\n): Minipass<string, string>\nexport function globStreamSync(\n pattern: string | string[],\n options: GlobOptions\n): Minipass<Path, Path> | Minipass<string, string>\nexport function globStreamSync(\n pattern: string | string[],\n options: GlobOptions = {}\n) {\n return new Glob(pattern, options).streamSync()\n}\n\n/**\n * Return a stream that emits all the strings or `Path` objects and\n * then emits `end` when completed.\n */\nexport function globStream(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesFalse\n): Minipass<string, string>\nexport function globStream(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesTrue\n): Minipass<Path, Path>\nexport function globStream(\n pattern: string | string[],\n options?: GlobOptionsWithFileTypesUnset | undefined\n): Minipass<string, string>\nexport function globStream(\n pattern: string | string[],\n options: GlobOptions\n): Minipass<Path, Path> | Minipass<string, string>\nexport function globStream(\n pattern: string | string[],\n options: GlobOptions = {}\n) {\n return new Glob(pattern, options).stream()\n}\n\n/**\n * Synchronous form of {@link glob}\n */\nexport function globSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesFalse\n): string[]\nexport function globSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesTrue\n): Path[]\nexport function globSync(\n pattern: string | string[],\n options?: GlobOptionsWithFileTypesUnset | undefined\n): string[]\nexport function globSync(\n pattern: string | string[],\n options: GlobOptions\n): Path[] | string[]\nexport function globSync(\n pattern: string | string[],\n options: GlobOptions = {}\n) {\n return new Glob(pattern, options).walkSync()\n}\n\n/**\n * Perform an asynchronous glob search for the pattern(s) specified. Returns\n * [Path](https://isaacs.github.io/path-scurry/classes/PathBase) objects if the\n * {@link withFileTypes} option is set to `true`. See {@link GlobOptions} for\n * full option descriptions.\n */\nasync function glob_(\n pattern: string | string[],\n options?: GlobOptionsWithFileTypesUnset | undefined\n): Promise<string[]>\nasync function glob_(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesTrue\n): Promise<Path[]>\nasync function glob_(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesFalse\n): Promise<string[]>\nasync function glob_(\n pattern: string | string[],\n options: GlobOptions\n): Promise<Path[] | string[]>\nasync function glob_(\n pattern: string | string[],\n options: GlobOptions = {}\n) {\n return new Glob(pattern, options).walk()\n}\n\n/**\n * Return a sync iterator for walking glob pattern matches.\n */\nexport function globIterateSync(\n pattern: string | string[],\n options?: GlobOptionsWithFileTypesUnset | undefined\n): Generator<string, void, void>\nexport function globIterateSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesTrue\n): Generator<Path, void, void>\nexport function globIterateSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesFalse\n): Generator<string, void, void>\nexport function globIterateSync(\n pattern: string | string[],\n options: GlobOptions\n): Generator<Path, void, void> | Generator<string, void, void>\nexport function globIterateSync(\n pattern: string | string[],\n options: GlobOptions = {}\n) {\n return new Glob(pattern, options).iterateSync()\n}\n\n/**\n * Return an async iterator for walking glob pattern matches.\n */\nexport function globIterate(\n pattern: string | string[],\n options?: GlobOptionsWithFileTypesUnset | undefined\n): AsyncGenerator<string, void, void>\nexport function globIterate(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesTrue\n): AsyncGenerator<Path, void, void>\nexport function globIterate(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesFalse\n): AsyncGenerator<string, void, void>\nexport function globIterate(\n pattern: string | string[],\n options: GlobOptions\n): AsyncGenerator<Path, void, void> | AsyncGenerator<string, void, void>\nexport function globIterate(\n pattern: string | string[],\n options: GlobOptions = {}\n) {\n return new Glob(pattern, options).iterate()\n}\n\n// aliases: glob.sync.stream() glob.stream.sync() glob.sync() etc\nexport const streamSync = globStreamSync\nexport const stream = Object.assign(globStream, { sync: globStreamSync })\nexport const iterateSync = globIterateSync\nexport const iterate = Object.assign(globIterate, {\n sync: globIterateSync,\n})\nexport const sync = Object.assign(globSync, {\n stream: globStreamSync,\n iterate: globIterateSync,\n})\n\n/* c8 ignore start */\nexport { escape, unescape } from 'minimatch'\nexport { Glob } from './glob.js'\nexport type {\n GlobOptions,\n GlobOptionsWithFileTypesFalse,\n GlobOptionsWithFileTypesTrue,\n GlobOptionsWithFileTypesUnset,\n} from './glob.js'\nexport { hasMagic } from './has-magic.js'\nexport type { IgnoreLike } from './ignore.js'\nexport type { MatchStream } from './walker.js'\n/* c8 ignore stop */\n\nexport const glob = Object.assign(glob_, {\n glob: glob_,\n globSync,\n sync,\n globStream,\n stream,\n globStreamSync,\n streamSync,\n globIterate,\n iterate,\n globIterateSync,\n iterateSync,\n Glob,\n hasMagic,\n escape,\n unescape,\n})\nglob.glob = glob\n"]}
@@ -0,0 +1,4 @@
1
+ {
2
+ "version": "10.3.3",
3
+ "type": "module"
4
+ }
@@ -0,0 +1,77 @@
1
+ /// <reference types="node" />
2
+ import { GLOBSTAR } from 'minimatch';
3
+ export type MMPattern = string | RegExp | typeof GLOBSTAR;
4
+ export type PatternList = [p: MMPattern, ...rest: MMPattern[]];
5
+ export type UNCPatternList = [
6
+ p0: '',
7
+ p1: '',
8
+ p2: string,
9
+ p3: string,
10
+ ...rest: MMPattern[]
11
+ ];
12
+ export type DrivePatternList = [p0: string, ...rest: MMPattern[]];
13
+ export type AbsolutePatternList = [p0: '', ...rest: MMPattern[]];
14
+ export type GlobList = [p: string, ...rest: string[]];
15
+ /**
16
+ * An immutable-ish view on an array of glob parts and their parsed
17
+ * results
18
+ */
19
+ export declare class Pattern {
20
+ #private;
21
+ readonly length: number;
22
+ constructor(patternList: MMPattern[], globList: string[], index: number, platform: NodeJS.Platform);
23
+ /**
24
+ * The first entry in the parsed list of patterns
25
+ */
26
+ pattern(): MMPattern;
27
+ /**
28
+ * true of if pattern() returns a string
29
+ */
30
+ isString(): boolean;
31
+ /**
32
+ * true of if pattern() returns GLOBSTAR
33
+ */
34
+ isGlobstar(): boolean;
35
+ /**
36
+ * true if pattern() returns a regexp
37
+ */
38
+ isRegExp(): boolean;
39
+ /**
40
+ * The /-joined set of glob parts that make up this pattern
41
+ */
42
+ globString(): string;
43
+ /**
44
+ * true if there are more pattern parts after this one
45
+ */
46
+ hasMore(): boolean;
47
+ /**
48
+ * The rest of the pattern after this part, or null if this is the end
49
+ */
50
+ rest(): Pattern | null;
51
+ /**
52
+ * true if the pattern represents a //unc/path/ on windows
53
+ */
54
+ isUNC(): boolean;
55
+ /**
56
+ * True if the pattern starts with a drive letter on Windows
57
+ */
58
+ isDrive(): boolean;
59
+ /**
60
+ * True if the pattern is rooted on an absolute path
61
+ */
62
+ isAbsolute(): boolean;
63
+ /**
64
+ * consume the root of the pattern, and return it
65
+ */
66
+ root(): string;
67
+ /**
68
+ * Check to see if the current globstar pattern is allowed to follow
69
+ * a symbolic link.
70
+ */
71
+ checkFollowGlobstar(): boolean;
72
+ /**
73
+ * Mark that the current globstar pattern is following a symbolic link
74
+ */
75
+ markFollowGlobstar(): boolean;
76
+ }
77
+ //# sourceMappingURL=pattern.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../../src/pattern.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,QAAQ,CAAA;AAGzD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;AAC9D,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,GAAG,IAAI,EAAE,SAAS,EAAE;CACrB,CAAA;AACD,MAAM,MAAM,gBAAgB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;AACjE,MAAM,MAAM,mBAAmB,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;AAChE,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,CAAA;AAMrD;;;GAGG;AACH,qBAAa,OAAO;;IAIlB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;gBAUrB,WAAW,EAAE,SAAS,EAAE,EACxB,QAAQ,EAAE,MAAM,EAAE,EAClB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,CAAC,QAAQ;IA6D3B;;OAEG;IACH,OAAO,IAAI,SAAS;IAIpB;;OAEG;IACH,QAAQ,IAAI,OAAO;IAGnB;;OAEG;IACH,UAAU,IAAI,OAAO;IAGrB;;OAEG;IACH,QAAQ,IAAI,OAAO;IAInB;;OAEG;IACH,UAAU,IAAI,MAAM;IAUpB;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACH,IAAI,IAAI,OAAO,GAAG,IAAI;IAetB;;OAEG;IACH,KAAK,IAAI,OAAO;IAoBhB;;OAEG;IACH,OAAO,IAAI,OAAO;IAelB;;OAEG;IACH,UAAU,IAAI,OAAO;IAUrB;;OAEG;IACH,IAAI,IAAI,MAAM;IAOd;;;OAGG;IACH,mBAAmB,IAAI,OAAO;IAQ9B;;OAEG;IACH,kBAAkB,IAAI,OAAO;CAM9B"}
@@ -0,0 +1,215 @@
1
+ // this is just a very light wrapper around 2 arrays with an offset index
2
+ import { GLOBSTAR } from 'minimatch';
3
+ const isPatternList = (pl) => pl.length >= 1;
4
+ const isGlobList = (gl) => gl.length >= 1;
5
+ /**
6
+ * An immutable-ish view on an array of glob parts and their parsed
7
+ * results
8
+ */
9
+ export class Pattern {
10
+ #patternList;
11
+ #globList;
12
+ #index;
13
+ length;
14
+ #platform;
15
+ #rest;
16
+ #globString;
17
+ #isDrive;
18
+ #isUNC;
19
+ #isAbsolute;
20
+ #followGlobstar = true;
21
+ constructor(patternList, globList, index, platform) {
22
+ if (!isPatternList(patternList)) {
23
+ throw new TypeError('empty pattern list');
24
+ }
25
+ if (!isGlobList(globList)) {
26
+ throw new TypeError('empty glob list');
27
+ }
28
+ if (globList.length !== patternList.length) {
29
+ throw new TypeError('mismatched pattern list and glob list lengths');
30
+ }
31
+ this.length = patternList.length;
32
+ if (index < 0 || index >= this.length) {
33
+ throw new TypeError('index out of range');
34
+ }
35
+ this.#patternList = patternList;
36
+ this.#globList = globList;
37
+ this.#index = index;
38
+ this.#platform = platform;
39
+ // normalize root entries of absolute patterns on initial creation.
40
+ if (this.#index === 0) {
41
+ // c: => ['c:/']
42
+ // C:/ => ['C:/']
43
+ // C:/x => ['C:/', 'x']
44
+ // //host/share => ['//host/share/']
45
+ // //host/share/ => ['//host/share/']
46
+ // //host/share/x => ['//host/share/', 'x']
47
+ // /etc => ['/', 'etc']
48
+ // / => ['/']
49
+ if (this.isUNC()) {
50
+ // '' / '' / 'host' / 'share'
51
+ const [p0, p1, p2, p3, ...prest] = this.#patternList;
52
+ const [g0, g1, g2, g3, ...grest] = this.#globList;
53
+ if (prest[0] === '') {
54
+ // ends in /
55
+ prest.shift();
56
+ grest.shift();
57
+ }
58
+ const p = [p0, p1, p2, p3, ''].join('/');
59
+ const g = [g0, g1, g2, g3, ''].join('/');
60
+ this.#patternList = [p, ...prest];
61
+ this.#globList = [g, ...grest];
62
+ this.length = this.#patternList.length;
63
+ }
64
+ else if (this.isDrive() || this.isAbsolute()) {
65
+ const [p1, ...prest] = this.#patternList;
66
+ const [g1, ...grest] = this.#globList;
67
+ if (prest[0] === '') {
68
+ // ends in /
69
+ prest.shift();
70
+ grest.shift();
71
+ }
72
+ const p = p1 + '/';
73
+ const g = g1 + '/';
74
+ this.#patternList = [p, ...prest];
75
+ this.#globList = [g, ...grest];
76
+ this.length = this.#patternList.length;
77
+ }
78
+ }
79
+ }
80
+ /**
81
+ * The first entry in the parsed list of patterns
82
+ */
83
+ pattern() {
84
+ return this.#patternList[this.#index];
85
+ }
86
+ /**
87
+ * true of if pattern() returns a string
88
+ */
89
+ isString() {
90
+ return typeof this.#patternList[this.#index] === 'string';
91
+ }
92
+ /**
93
+ * true of if pattern() returns GLOBSTAR
94
+ */
95
+ isGlobstar() {
96
+ return this.#patternList[this.#index] === GLOBSTAR;
97
+ }
98
+ /**
99
+ * true if pattern() returns a regexp
100
+ */
101
+ isRegExp() {
102
+ return this.#patternList[this.#index] instanceof RegExp;
103
+ }
104
+ /**
105
+ * The /-joined set of glob parts that make up this pattern
106
+ */
107
+ globString() {
108
+ return (this.#globString =
109
+ this.#globString ||
110
+ (this.#index === 0
111
+ ? this.isAbsolute()
112
+ ? this.#globList[0] + this.#globList.slice(1).join('/')
113
+ : this.#globList.join('/')
114
+ : this.#globList.slice(this.#index).join('/')));
115
+ }
116
+ /**
117
+ * true if there are more pattern parts after this one
118
+ */
119
+ hasMore() {
120
+ return this.length > this.#index + 1;
121
+ }
122
+ /**
123
+ * The rest of the pattern after this part, or null if this is the end
124
+ */
125
+ rest() {
126
+ if (this.#rest !== undefined)
127
+ return this.#rest;
128
+ if (!this.hasMore())
129
+ return (this.#rest = null);
130
+ this.#rest = new Pattern(this.#patternList, this.#globList, this.#index + 1, this.#platform);
131
+ this.#rest.#isAbsolute = this.#isAbsolute;
132
+ this.#rest.#isUNC = this.#isUNC;
133
+ this.#rest.#isDrive = this.#isDrive;
134
+ return this.#rest;
135
+ }
136
+ /**
137
+ * true if the pattern represents a //unc/path/ on windows
138
+ */
139
+ isUNC() {
140
+ const pl = this.#patternList;
141
+ return this.#isUNC !== undefined
142
+ ? this.#isUNC
143
+ : (this.#isUNC =
144
+ this.#platform === 'win32' &&
145
+ this.#index === 0 &&
146
+ pl[0] === '' &&
147
+ pl[1] === '' &&
148
+ typeof pl[2] === 'string' &&
149
+ !!pl[2] &&
150
+ typeof pl[3] === 'string' &&
151
+ !!pl[3]);
152
+ }
153
+ // pattern like C:/...
154
+ // split = ['C:', ...]
155
+ // XXX: would be nice to handle patterns like `c:*` to test the cwd
156
+ // in c: for *, but I don't know of a way to even figure out what that
157
+ // cwd is without actually chdir'ing into it?
158
+ /**
159
+ * True if the pattern starts with a drive letter on Windows
160
+ */
161
+ isDrive() {
162
+ const pl = this.#patternList;
163
+ return this.#isDrive !== undefined
164
+ ? this.#isDrive
165
+ : (this.#isDrive =
166
+ this.#platform === 'win32' &&
167
+ this.#index === 0 &&
168
+ this.length > 1 &&
169
+ typeof pl[0] === 'string' &&
170
+ /^[a-z]:$/i.test(pl[0]));
171
+ }
172
+ // pattern = '/' or '/...' or '/x/...'
173
+ // split = ['', ''] or ['', ...] or ['', 'x', ...]
174
+ // Drive and UNC both considered absolute on windows
175
+ /**
176
+ * True if the pattern is rooted on an absolute path
177
+ */
178
+ isAbsolute() {
179
+ const pl = this.#patternList;
180
+ return this.#isAbsolute !== undefined
181
+ ? this.#isAbsolute
182
+ : (this.#isAbsolute =
183
+ (pl[0] === '' && pl.length > 1) ||
184
+ this.isDrive() ||
185
+ this.isUNC());
186
+ }
187
+ /**
188
+ * consume the root of the pattern, and return it
189
+ */
190
+ root() {
191
+ const p = this.#patternList[0];
192
+ return typeof p === 'string' && this.isAbsolute() && this.#index === 0
193
+ ? p
194
+ : '';
195
+ }
196
+ /**
197
+ * Check to see if the current globstar pattern is allowed to follow
198
+ * a symbolic link.
199
+ */
200
+ checkFollowGlobstar() {
201
+ return !(this.#index === 0 ||
202
+ !this.isGlobstar() ||
203
+ !this.#followGlobstar);
204
+ }
205
+ /**
206
+ * Mark that the current globstar pattern is following a symbolic link
207
+ */
208
+ markFollowGlobstar() {
209
+ if (this.#index === 0 || !this.isGlobstar() || !this.#followGlobstar)
210
+ return false;
211
+ this.#followGlobstar = false;
212
+ return true;
213
+ }
214
+ }
215
+ //# sourceMappingURL=pattern.js.map