korext 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (517) hide show
  1. package/bin/korext.js +278 -0
  2. package/korext-cli-0.1.0.tgz +0 -0
  3. package/node_modules/ansi-regex/index.d.ts +37 -0
  4. package/node_modules/ansi-regex/index.js +10 -0
  5. package/node_modules/ansi-regex/license +9 -0
  6. package/node_modules/ansi-regex/package.json +55 -0
  7. package/node_modules/ansi-regex/readme.md +78 -0
  8. package/node_modules/ansi-styles/index.d.ts +345 -0
  9. package/node_modules/ansi-styles/index.js +163 -0
  10. package/node_modules/ansi-styles/license +9 -0
  11. package/node_modules/ansi-styles/package.json +56 -0
  12. package/node_modules/ansi-styles/readme.md +152 -0
  13. package/node_modules/balanced-match/LICENSE.md +23 -0
  14. package/node_modules/balanced-match/README.md +57 -0
  15. package/node_modules/balanced-match/dist/commonjs/index.d.ts +9 -0
  16. package/node_modules/balanced-match/dist/commonjs/index.d.ts.map +1 -0
  17. package/node_modules/balanced-match/dist/commonjs/index.js +59 -0
  18. package/node_modules/balanced-match/dist/commonjs/index.js.map +1 -0
  19. package/node_modules/balanced-match/dist/commonjs/package.json +3 -0
  20. package/node_modules/balanced-match/dist/esm/index.d.ts +9 -0
  21. package/node_modules/balanced-match/dist/esm/index.d.ts.map +1 -0
  22. package/node_modules/balanced-match/dist/esm/index.js +54 -0
  23. package/node_modules/balanced-match/dist/esm/index.js.map +1 -0
  24. package/node_modules/balanced-match/dist/esm/package.json +3 -0
  25. package/node_modules/balanced-match/package.json +68 -0
  26. package/node_modules/base64-js/LICENSE +21 -0
  27. package/node_modules/base64-js/README.md +34 -0
  28. package/node_modules/base64-js/base64js.min.js +1 -0
  29. package/node_modules/base64-js/index.d.ts +3 -0
  30. package/node_modules/base64-js/index.js +150 -0
  31. package/node_modules/base64-js/package.json +47 -0
  32. package/node_modules/bl/.travis.yml +17 -0
  33. package/node_modules/bl/BufferList.js +396 -0
  34. package/node_modules/bl/LICENSE.md +13 -0
  35. package/node_modules/bl/README.md +247 -0
  36. package/node_modules/bl/bl.js +84 -0
  37. package/node_modules/bl/package.json +37 -0
  38. package/node_modules/bl/test/convert.js +21 -0
  39. package/node_modules/bl/test/indexOf.js +492 -0
  40. package/node_modules/bl/test/isBufferList.js +32 -0
  41. package/node_modules/bl/test/test.js +869 -0
  42. package/node_modules/brace-expansion/LICENSE +23 -0
  43. package/node_modules/brace-expansion/README.md +94 -0
  44. package/node_modules/brace-expansion/dist/commonjs/index.d.ts +6 -0
  45. package/node_modules/brace-expansion/dist/commonjs/index.d.ts.map +1 -0
  46. package/node_modules/brace-expansion/dist/commonjs/index.js +199 -0
  47. package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -0
  48. package/node_modules/brace-expansion/dist/commonjs/package.json +3 -0
  49. package/node_modules/brace-expansion/dist/esm/index.d.ts +6 -0
  50. package/node_modules/brace-expansion/dist/esm/index.d.ts.map +1 -0
  51. package/node_modules/brace-expansion/dist/esm/index.js +195 -0
  52. package/node_modules/brace-expansion/dist/esm/index.js.map +1 -0
  53. package/node_modules/brace-expansion/dist/esm/package.json +3 -0
  54. package/node_modules/brace-expansion/package.json +64 -0
  55. package/node_modules/buffer/AUTHORS.md +70 -0
  56. package/node_modules/buffer/LICENSE +21 -0
  57. package/node_modules/buffer/README.md +410 -0
  58. package/node_modules/buffer/index.d.ts +186 -0
  59. package/node_modules/buffer/index.js +1817 -0
  60. package/node_modules/buffer/package.json +96 -0
  61. package/node_modules/chalk/index.d.ts +415 -0
  62. package/node_modules/chalk/license +9 -0
  63. package/node_modules/chalk/package.json +68 -0
  64. package/node_modules/chalk/readme.md +341 -0
  65. package/node_modules/chalk/source/index.js +229 -0
  66. package/node_modules/chalk/source/templates.js +134 -0
  67. package/node_modules/chalk/source/util.js +39 -0
  68. package/node_modules/cli-cursor/index.d.ts +45 -0
  69. package/node_modules/cli-cursor/index.js +35 -0
  70. package/node_modules/cli-cursor/license +9 -0
  71. package/node_modules/cli-cursor/package.json +46 -0
  72. package/node_modules/cli-cursor/readme.md +55 -0
  73. package/node_modules/cli-spinners/index.d.ts +128 -0
  74. package/node_modules/cli-spinners/index.js +15 -0
  75. package/node_modules/cli-spinners/license +9 -0
  76. package/node_modules/cli-spinners/package.json +50 -0
  77. package/node_modules/cli-spinners/readme.md +54 -0
  78. package/node_modules/cli-spinners/spinners.json +1622 -0
  79. package/node_modules/clone/.npmignore +4 -0
  80. package/node_modules/clone/LICENSE +18 -0
  81. package/node_modules/clone/README.md +126 -0
  82. package/node_modules/clone/clone.iml +10 -0
  83. package/node_modules/clone/clone.js +166 -0
  84. package/node_modules/clone/package.json +51 -0
  85. package/node_modules/color-convert/CHANGELOG.md +54 -0
  86. package/node_modules/color-convert/LICENSE +21 -0
  87. package/node_modules/color-convert/README.md +68 -0
  88. package/node_modules/color-convert/conversions.js +839 -0
  89. package/node_modules/color-convert/index.js +81 -0
  90. package/node_modules/color-convert/package.json +48 -0
  91. package/node_modules/color-convert/route.js +97 -0
  92. package/node_modules/color-name/LICENSE +8 -0
  93. package/node_modules/color-name/README.md +11 -0
  94. package/node_modules/color-name/index.js +152 -0
  95. package/node_modules/color-name/package.json +28 -0
  96. package/node_modules/commander/LICENSE +22 -0
  97. package/node_modules/commander/Readme.md +1176 -0
  98. package/node_modules/commander/esm.mjs +16 -0
  99. package/node_modules/commander/index.js +24 -0
  100. package/node_modules/commander/lib/argument.js +150 -0
  101. package/node_modules/commander/lib/command.js +2777 -0
  102. package/node_modules/commander/lib/error.js +39 -0
  103. package/node_modules/commander/lib/help.js +747 -0
  104. package/node_modules/commander/lib/option.js +380 -0
  105. package/node_modules/commander/lib/suggestSimilar.js +101 -0
  106. package/node_modules/commander/package-support.json +19 -0
  107. package/node_modules/commander/package.json +82 -0
  108. package/node_modules/commander/typings/esm.d.mts +3 -0
  109. package/node_modules/commander/typings/index.d.ts +1113 -0
  110. package/node_modules/data-uri-to-buffer/README.md +88 -0
  111. package/node_modules/data-uri-to-buffer/dist/index.d.ts +15 -0
  112. package/node_modules/data-uri-to-buffer/dist/index.js +53 -0
  113. package/node_modules/data-uri-to-buffer/dist/index.js.map +1 -0
  114. package/node_modules/data-uri-to-buffer/package.json +62 -0
  115. package/node_modules/data-uri-to-buffer/src/index.ts +68 -0
  116. package/node_modules/defaults/LICENSE +22 -0
  117. package/node_modules/defaults/README.md +39 -0
  118. package/node_modules/defaults/index.js +13 -0
  119. package/node_modules/defaults/package.json +33 -0
  120. package/node_modules/defaults/test.js +34 -0
  121. package/node_modules/fetch-blob/LICENSE +21 -0
  122. package/node_modules/fetch-blob/README.md +106 -0
  123. package/node_modules/fetch-blob/file.d.ts +2 -0
  124. package/node_modules/fetch-blob/file.js +49 -0
  125. package/node_modules/fetch-blob/from.d.ts +26 -0
  126. package/node_modules/fetch-blob/from.js +100 -0
  127. package/node_modules/fetch-blob/index.d.ts +3 -0
  128. package/node_modules/fetch-blob/index.js +250 -0
  129. package/node_modules/fetch-blob/package.json +56 -0
  130. package/node_modules/fetch-blob/streams.cjs +51 -0
  131. package/node_modules/formdata-polyfill/FormData.js +441 -0
  132. package/node_modules/formdata-polyfill/LICENSE +21 -0
  133. package/node_modules/formdata-polyfill/README.md +145 -0
  134. package/node_modules/formdata-polyfill/esm.min.d.ts +5 -0
  135. package/node_modules/formdata-polyfill/esm.min.js +40 -0
  136. package/node_modules/formdata-polyfill/formdata-to-blob.js +39 -0
  137. package/node_modules/formdata-polyfill/formdata.min.js +21 -0
  138. package/node_modules/formdata-polyfill/package.json +50 -0
  139. package/node_modules/glob/LICENSE.md +63 -0
  140. package/node_modules/glob/README.md +1203 -0
  141. package/node_modules/glob/dist/commonjs/glob.d.ts +396 -0
  142. package/node_modules/glob/dist/commonjs/glob.d.ts.map +1 -0
  143. package/node_modules/glob/dist/commonjs/glob.js +248 -0
  144. package/node_modules/glob/dist/commonjs/glob.js.map +1 -0
  145. package/node_modules/glob/dist/commonjs/has-magic.d.ts +14 -0
  146. package/node_modules/glob/dist/commonjs/has-magic.d.ts.map +1 -0
  147. package/node_modules/glob/dist/commonjs/has-magic.js +27 -0
  148. package/node_modules/glob/dist/commonjs/has-magic.js.map +1 -0
  149. package/node_modules/glob/dist/commonjs/ignore.d.ts +24 -0
  150. package/node_modules/glob/dist/commonjs/ignore.d.ts.map +1 -0
  151. package/node_modules/glob/dist/commonjs/ignore.js +119 -0
  152. package/node_modules/glob/dist/commonjs/ignore.js.map +1 -0
  153. package/node_modules/glob/dist/commonjs/index.d.ts +97 -0
  154. package/node_modules/glob/dist/commonjs/index.d.ts.map +1 -0
  155. package/node_modules/glob/dist/commonjs/index.js +68 -0
  156. package/node_modules/glob/dist/commonjs/index.js.map +1 -0
  157. package/node_modules/glob/dist/commonjs/index.min.js +4 -0
  158. package/node_modules/glob/dist/commonjs/index.min.js.map +7 -0
  159. package/node_modules/glob/dist/commonjs/package.json +3 -0
  160. package/node_modules/glob/dist/commonjs/pattern.d.ts +79 -0
  161. package/node_modules/glob/dist/commonjs/pattern.d.ts.map +1 -0
  162. package/node_modules/glob/dist/commonjs/pattern.js +223 -0
  163. package/node_modules/glob/dist/commonjs/pattern.js.map +1 -0
  164. package/node_modules/glob/dist/commonjs/processor.d.ts +59 -0
  165. package/node_modules/glob/dist/commonjs/processor.d.ts.map +1 -0
  166. package/node_modules/glob/dist/commonjs/processor.js +301 -0
  167. package/node_modules/glob/dist/commonjs/processor.js.map +1 -0
  168. package/node_modules/glob/dist/commonjs/walker.d.ts +97 -0
  169. package/node_modules/glob/dist/commonjs/walker.d.ts.map +1 -0
  170. package/node_modules/glob/dist/commonjs/walker.js +387 -0
  171. package/node_modules/glob/dist/commonjs/walker.js.map +1 -0
  172. package/node_modules/glob/dist/esm/glob.d.ts +396 -0
  173. package/node_modules/glob/dist/esm/glob.d.ts.map +1 -0
  174. package/node_modules/glob/dist/esm/glob.js +244 -0
  175. package/node_modules/glob/dist/esm/glob.js.map +1 -0
  176. package/node_modules/glob/dist/esm/has-magic.d.ts +14 -0
  177. package/node_modules/glob/dist/esm/has-magic.d.ts.map +1 -0
  178. package/node_modules/glob/dist/esm/has-magic.js +23 -0
  179. package/node_modules/glob/dist/esm/has-magic.js.map +1 -0
  180. package/node_modules/glob/dist/esm/ignore.d.ts +24 -0
  181. package/node_modules/glob/dist/esm/ignore.d.ts.map +1 -0
  182. package/node_modules/glob/dist/esm/ignore.js +115 -0
  183. package/node_modules/glob/dist/esm/ignore.js.map +1 -0
  184. package/node_modules/glob/dist/esm/index.d.ts +97 -0
  185. package/node_modules/glob/dist/esm/index.d.ts.map +1 -0
  186. package/node_modules/glob/dist/esm/index.js +55 -0
  187. package/node_modules/glob/dist/esm/index.js.map +1 -0
  188. package/node_modules/glob/dist/esm/index.min.js +4 -0
  189. package/node_modules/glob/dist/esm/index.min.js.map +7 -0
  190. package/node_modules/glob/dist/esm/package.json +3 -0
  191. package/node_modules/glob/dist/esm/pattern.d.ts +79 -0
  192. package/node_modules/glob/dist/esm/pattern.d.ts.map +1 -0
  193. package/node_modules/glob/dist/esm/pattern.js +219 -0
  194. package/node_modules/glob/dist/esm/pattern.js.map +1 -0
  195. package/node_modules/glob/dist/esm/processor.d.ts +59 -0
  196. package/node_modules/glob/dist/esm/processor.d.ts.map +1 -0
  197. package/node_modules/glob/dist/esm/processor.js +294 -0
  198. package/node_modules/glob/dist/esm/processor.js.map +1 -0
  199. package/node_modules/glob/dist/esm/walker.d.ts +97 -0
  200. package/node_modules/glob/dist/esm/walker.d.ts.map +1 -0
  201. package/node_modules/glob/dist/esm/walker.js +381 -0
  202. package/node_modules/glob/dist/esm/walker.js.map +1 -0
  203. package/node_modules/glob/package.json +98 -0
  204. package/node_modules/has-flag/index.d.ts +39 -0
  205. package/node_modules/has-flag/index.js +8 -0
  206. package/node_modules/has-flag/license +9 -0
  207. package/node_modules/has-flag/package.json +46 -0
  208. package/node_modules/has-flag/readme.md +89 -0
  209. package/node_modules/ieee754/LICENSE +11 -0
  210. package/node_modules/ieee754/README.md +51 -0
  211. package/node_modules/ieee754/index.d.ts +10 -0
  212. package/node_modules/ieee754/index.js +85 -0
  213. package/node_modules/ieee754/package.json +52 -0
  214. package/node_modules/inherits/LICENSE +16 -0
  215. package/node_modules/inherits/README.md +42 -0
  216. package/node_modules/inherits/inherits.js +9 -0
  217. package/node_modules/inherits/inherits_browser.js +27 -0
  218. package/node_modules/inherits/package.json +29 -0
  219. package/node_modules/is-interactive/index.d.ts +31 -0
  220. package/node_modules/is-interactive/index.js +9 -0
  221. package/node_modules/is-interactive/license +9 -0
  222. package/node_modules/is-interactive/package.json +38 -0
  223. package/node_modules/is-interactive/readme.md +51 -0
  224. package/node_modules/is-unicode-supported/index.d.ts +14 -0
  225. package/node_modules/is-unicode-supported/index.js +13 -0
  226. package/node_modules/is-unicode-supported/license +9 -0
  227. package/node_modules/is-unicode-supported/package.json +41 -0
  228. package/node_modules/is-unicode-supported/readme.md +35 -0
  229. package/node_modules/log-symbols/browser.js +8 -0
  230. package/node_modules/log-symbols/index.d.ts +25 -0
  231. package/node_modules/log-symbols/index.js +19 -0
  232. package/node_modules/log-symbols/license +9 -0
  233. package/node_modules/log-symbols/package.json +52 -0
  234. package/node_modules/log-symbols/readme.md +51 -0
  235. package/node_modules/lru-cache/LICENSE.md +55 -0
  236. package/node_modules/lru-cache/README.md +383 -0
  237. package/node_modules/lru-cache/dist/commonjs/index.d.ts +1323 -0
  238. package/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -0
  239. package/node_modules/lru-cache/dist/commonjs/index.js +1595 -0
  240. package/node_modules/lru-cache/dist/commonjs/index.js.map +1 -0
  241. package/node_modules/lru-cache/dist/commonjs/index.min.js +2 -0
  242. package/node_modules/lru-cache/dist/commonjs/index.min.js.map +7 -0
  243. package/node_modules/lru-cache/dist/commonjs/package.json +3 -0
  244. package/node_modules/lru-cache/dist/esm/index.d.ts +1323 -0
  245. package/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -0
  246. package/node_modules/lru-cache/dist/esm/index.js +1591 -0
  247. package/node_modules/lru-cache/dist/esm/index.js.map +1 -0
  248. package/node_modules/lru-cache/dist/esm/index.min.js +2 -0
  249. package/node_modules/lru-cache/dist/esm/index.min.js.map +7 -0
  250. package/node_modules/lru-cache/dist/esm/package.json +3 -0
  251. package/node_modules/lru-cache/package.json +93 -0
  252. package/node_modules/mimic-fn/index.d.ts +54 -0
  253. package/node_modules/mimic-fn/index.js +13 -0
  254. package/node_modules/mimic-fn/license +9 -0
  255. package/node_modules/mimic-fn/package.json +42 -0
  256. package/node_modules/mimic-fn/readme.md +69 -0
  257. package/node_modules/minimatch/LICENSE.md +55 -0
  258. package/node_modules/minimatch/README.md +528 -0
  259. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
  260. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
  261. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
  262. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
  263. package/node_modules/minimatch/dist/commonjs/ast.d.ts +22 -0
  264. package/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -0
  265. package/node_modules/minimatch/dist/commonjs/ast.js +846 -0
  266. package/node_modules/minimatch/dist/commonjs/ast.js.map +1 -0
  267. package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +8 -0
  268. package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +1 -0
  269. package/node_modules/minimatch/dist/commonjs/brace-expressions.js +150 -0
  270. package/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -0
  271. package/node_modules/minimatch/dist/commonjs/escape.d.ts +15 -0
  272. package/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
  273. package/node_modules/minimatch/dist/commonjs/escape.js +30 -0
  274. package/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
  275. package/node_modules/minimatch/dist/commonjs/index.d.ts +174 -0
  276. package/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
  277. package/node_modules/minimatch/dist/commonjs/index.js +1121 -0
  278. package/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
  279. package/node_modules/minimatch/dist/commonjs/package.json +3 -0
  280. package/node_modules/minimatch/dist/commonjs/unescape.d.ts +22 -0
  281. package/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
  282. package/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
  283. package/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
  284. package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
  285. package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
  286. package/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
  287. package/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
  288. package/node_modules/minimatch/dist/esm/ast.d.ts +22 -0
  289. package/node_modules/minimatch/dist/esm/ast.d.ts.map +1 -0
  290. package/node_modules/minimatch/dist/esm/ast.js +842 -0
  291. package/node_modules/minimatch/dist/esm/ast.js.map +1 -0
  292. package/node_modules/minimatch/dist/esm/brace-expressions.d.ts +8 -0
  293. package/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +1 -0
  294. package/node_modules/minimatch/dist/esm/brace-expressions.js +146 -0
  295. package/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
  296. package/node_modules/minimatch/dist/esm/escape.d.ts +15 -0
  297. package/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
  298. package/node_modules/minimatch/dist/esm/escape.js +26 -0
  299. package/node_modules/minimatch/dist/esm/escape.js.map +1 -0
  300. package/node_modules/minimatch/dist/esm/index.d.ts +174 -0
  301. package/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
  302. package/node_modules/minimatch/dist/esm/index.js +1108 -0
  303. package/node_modules/minimatch/dist/esm/index.js.map +1 -0
  304. package/node_modules/minimatch/dist/esm/package.json +3 -0
  305. package/node_modules/minimatch/dist/esm/unescape.d.ts +22 -0
  306. package/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
  307. package/node_modules/minimatch/dist/esm/unescape.js +34 -0
  308. package/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
  309. package/node_modules/minimatch/package.json +67 -0
  310. package/node_modules/minipass/LICENSE.md +55 -0
  311. package/node_modules/minipass/README.md +825 -0
  312. package/node_modules/minipass/dist/commonjs/index.d.ts +545 -0
  313. package/node_modules/minipass/dist/commonjs/index.d.ts.map +1 -0
  314. package/node_modules/minipass/dist/commonjs/index.js +1038 -0
  315. package/node_modules/minipass/dist/commonjs/index.js.map +1 -0
  316. package/node_modules/minipass/dist/commonjs/package.json +3 -0
  317. package/node_modules/minipass/dist/esm/index.d.ts +545 -0
  318. package/node_modules/minipass/dist/esm/index.d.ts.map +1 -0
  319. package/node_modules/minipass/dist/esm/index.js +1020 -0
  320. package/node_modules/minipass/dist/esm/index.js.map +1 -0
  321. package/node_modules/minipass/dist/esm/package.json +3 -0
  322. package/node_modules/minipass/package.json +77 -0
  323. package/node_modules/node-domexception/.history/README_20210527203617.md +2 -0
  324. package/node_modules/node-domexception/.history/README_20210527212714.md +41 -0
  325. package/node_modules/node-domexception/.history/README_20210527213345.md +36 -0
  326. package/node_modules/node-domexception/.history/README_20210527213411.md +36 -0
  327. package/node_modules/node-domexception/.history/README_20210527213803.md +36 -0
  328. package/node_modules/node-domexception/.history/README_20210527214323.md +38 -0
  329. package/node_modules/node-domexception/.history/README_20210527214408.md +38 -0
  330. package/node_modules/node-domexception/.history/index_20210527203842.js +0 -0
  331. package/node_modules/node-domexception/.history/index_20210527203947.js +8 -0
  332. package/node_modules/node-domexception/.history/index_20210527204259.js +9 -0
  333. package/node_modules/node-domexception/.history/index_20210527204418.js +9 -0
  334. package/node_modules/node-domexception/.history/index_20210527204756.js +11 -0
  335. package/node_modules/node-domexception/.history/index_20210527204833.js +11 -0
  336. package/node_modules/node-domexception/.history/index_20210527211208.js +15 -0
  337. package/node_modules/node-domexception/.history/index_20210527211248.js +15 -0
  338. package/node_modules/node-domexception/.history/index_20210527212722.js +23 -0
  339. package/node_modules/node-domexception/.history/index_20210527212731.js +23 -0
  340. package/node_modules/node-domexception/.history/index_20210527212746.js +15 -0
  341. package/node_modules/node-domexception/.history/index_20210527212900.js +16 -0
  342. package/node_modules/node-domexception/.history/index_20210527213022.js +16 -0
  343. package/node_modules/node-domexception/.history/index_20210527213822.js +16 -0
  344. package/node_modules/node-domexception/.history/index_20210527213843.js +17 -0
  345. package/node_modules/node-domexception/.history/index_20210527213852.js +17 -0
  346. package/node_modules/node-domexception/.history/index_20210527213910.js +16 -0
  347. package/node_modules/node-domexception/.history/index_20210527214034.js +16 -0
  348. package/node_modules/node-domexception/.history/index_20210527214643.js +41 -0
  349. package/node_modules/node-domexception/.history/index_20210527214654.js +41 -0
  350. package/node_modules/node-domexception/.history/index_20210527214700.js +16 -0
  351. package/node_modules/node-domexception/.history/package_20210527203733.json +19 -0
  352. package/node_modules/node-domexception/.history/package_20210527203825.json +16 -0
  353. package/node_modules/node-domexception/.history/package_20210527204621.json +19 -0
  354. package/node_modules/node-domexception/.history/package_20210527204913.json +25 -0
  355. package/node_modules/node-domexception/.history/package_20210527204925.json +25 -0
  356. package/node_modules/node-domexception/.history/package_20210527205145.json +29 -0
  357. package/node_modules/node-domexception/.history/package_20210527205156.json +29 -0
  358. package/node_modules/node-domexception/.history/test_20210527205603.js +0 -0
  359. package/node_modules/node-domexception/.history/test_20210527205957.js +3 -0
  360. package/node_modules/node-domexception/.history/test_20210527210021.js +3 -0
  361. package/node_modules/node-domexception/LICENSE +21 -0
  362. package/node_modules/node-domexception/README.md +46 -0
  363. package/node_modules/node-domexception/index.js +16 -0
  364. package/node_modules/node-domexception/package.json +29 -0
  365. package/node_modules/node-fetch/@types/index.d.ts +219 -0
  366. package/node_modules/node-fetch/LICENSE.md +22 -0
  367. package/node_modules/node-fetch/README.md +872 -0
  368. package/node_modules/node-fetch/package.json +131 -0
  369. package/node_modules/node-fetch/src/body.js +397 -0
  370. package/node_modules/node-fetch/src/errors/abort-error.js +10 -0
  371. package/node_modules/node-fetch/src/errors/base.js +17 -0
  372. package/node_modules/node-fetch/src/errors/fetch-error.js +26 -0
  373. package/node_modules/node-fetch/src/headers.js +267 -0
  374. package/node_modules/node-fetch/src/index.js +417 -0
  375. package/node_modules/node-fetch/src/request.js +313 -0
  376. package/node_modules/node-fetch/src/response.js +160 -0
  377. package/node_modules/node-fetch/src/utils/get-search.js +9 -0
  378. package/node_modules/node-fetch/src/utils/is-redirect.js +11 -0
  379. package/node_modules/node-fetch/src/utils/is.js +87 -0
  380. package/node_modules/node-fetch/src/utils/multipart-parser.js +432 -0
  381. package/node_modules/node-fetch/src/utils/referrer.js +340 -0
  382. package/node_modules/onetime/index.d.ts +64 -0
  383. package/node_modules/onetime/index.js +44 -0
  384. package/node_modules/onetime/license +9 -0
  385. package/node_modules/onetime/package.json +43 -0
  386. package/node_modules/onetime/readme.md +94 -0
  387. package/node_modules/ora/index.d.ts +277 -0
  388. package/node_modules/ora/index.js +407 -0
  389. package/node_modules/ora/license +9 -0
  390. package/node_modules/ora/package.json +57 -0
  391. package/node_modules/ora/readme.md +264 -0
  392. package/node_modules/path-scurry/LICENSE.md +55 -0
  393. package/node_modules/path-scurry/README.md +636 -0
  394. package/node_modules/path-scurry/dist/commonjs/index.d.ts +1115 -0
  395. package/node_modules/path-scurry/dist/commonjs/index.d.ts.map +1 -0
  396. package/node_modules/path-scurry/dist/commonjs/index.js +2018 -0
  397. package/node_modules/path-scurry/dist/commonjs/index.js.map +1 -0
  398. package/node_modules/path-scurry/dist/commonjs/package.json +3 -0
  399. package/node_modules/path-scurry/dist/esm/index.d.ts +1115 -0
  400. package/node_modules/path-scurry/dist/esm/index.d.ts.map +1 -0
  401. package/node_modules/path-scurry/dist/esm/index.js +1983 -0
  402. package/node_modules/path-scurry/dist/esm/index.js.map +1 -0
  403. package/node_modules/path-scurry/dist/esm/package.json +3 -0
  404. package/node_modules/path-scurry/package.json +72 -0
  405. package/node_modules/readable-stream/CONTRIBUTING.md +38 -0
  406. package/node_modules/readable-stream/GOVERNANCE.md +136 -0
  407. package/node_modules/readable-stream/LICENSE +47 -0
  408. package/node_modules/readable-stream/README.md +106 -0
  409. package/node_modules/readable-stream/errors-browser.js +127 -0
  410. package/node_modules/readable-stream/errors.js +116 -0
  411. package/node_modules/readable-stream/experimentalWarning.js +17 -0
  412. package/node_modules/readable-stream/lib/_stream_duplex.js +126 -0
  413. package/node_modules/readable-stream/lib/_stream_passthrough.js +37 -0
  414. package/node_modules/readable-stream/lib/_stream_readable.js +1027 -0
  415. package/node_modules/readable-stream/lib/_stream_transform.js +190 -0
  416. package/node_modules/readable-stream/lib/_stream_writable.js +641 -0
  417. package/node_modules/readable-stream/lib/internal/streams/async_iterator.js +180 -0
  418. package/node_modules/readable-stream/lib/internal/streams/buffer_list.js +183 -0
  419. package/node_modules/readable-stream/lib/internal/streams/destroy.js +96 -0
  420. package/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +86 -0
  421. package/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
  422. package/node_modules/readable-stream/lib/internal/streams/from.js +52 -0
  423. package/node_modules/readable-stream/lib/internal/streams/pipeline.js +86 -0
  424. package/node_modules/readable-stream/lib/internal/streams/state.js +22 -0
  425. package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
  426. package/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
  427. package/node_modules/readable-stream/package.json +68 -0
  428. package/node_modules/readable-stream/readable-browser.js +9 -0
  429. package/node_modules/readable-stream/readable.js +16 -0
  430. package/node_modules/restore-cursor/index.d.ts +13 -0
  431. package/node_modules/restore-cursor/index.js +9 -0
  432. package/node_modules/restore-cursor/license +9 -0
  433. package/node_modules/restore-cursor/package.json +52 -0
  434. package/node_modules/restore-cursor/readme.md +26 -0
  435. package/node_modules/safe-buffer/LICENSE +21 -0
  436. package/node_modules/safe-buffer/README.md +584 -0
  437. package/node_modules/safe-buffer/index.d.ts +187 -0
  438. package/node_modules/safe-buffer/index.js +65 -0
  439. package/node_modules/safe-buffer/package.json +51 -0
  440. package/node_modules/signal-exit/LICENSE.txt +16 -0
  441. package/node_modules/signal-exit/README.md +39 -0
  442. package/node_modules/signal-exit/index.js +202 -0
  443. package/node_modules/signal-exit/package.json +38 -0
  444. package/node_modules/signal-exit/signals.js +53 -0
  445. package/node_modules/string_decoder/LICENSE +48 -0
  446. package/node_modules/string_decoder/README.md +47 -0
  447. package/node_modules/string_decoder/lib/string_decoder.js +296 -0
  448. package/node_modules/string_decoder/package.json +34 -0
  449. package/node_modules/strip-ansi/index.d.ts +17 -0
  450. package/node_modules/strip-ansi/index.js +4 -0
  451. package/node_modules/strip-ansi/license +9 -0
  452. package/node_modules/strip-ansi/package.json +54 -0
  453. package/node_modules/strip-ansi/readme.md +46 -0
  454. package/node_modules/supports-color/browser.js +5 -0
  455. package/node_modules/supports-color/index.js +135 -0
  456. package/node_modules/supports-color/license +9 -0
  457. package/node_modules/supports-color/package.json +53 -0
  458. package/node_modules/supports-color/readme.md +76 -0
  459. package/node_modules/util-deprecate/History.md +16 -0
  460. package/node_modules/util-deprecate/LICENSE +24 -0
  461. package/node_modules/util-deprecate/README.md +53 -0
  462. package/node_modules/util-deprecate/browser.js +67 -0
  463. package/node_modules/util-deprecate/node.js +6 -0
  464. package/node_modules/util-deprecate/package.json +27 -0
  465. package/node_modules/wcwidth/.npmignore +1 -0
  466. package/node_modules/wcwidth/LICENSE +30 -0
  467. package/node_modules/wcwidth/Readme.md +33 -0
  468. package/node_modules/wcwidth/combining.js +50 -0
  469. package/node_modules/wcwidth/docs/index.md +65 -0
  470. package/node_modules/wcwidth/index.js +99 -0
  471. package/node_modules/wcwidth/package.json +42 -0
  472. package/node_modules/wcwidth/test/index.js +64 -0
  473. package/node_modules/web-streams-polyfill/LICENSE +22 -0
  474. package/node_modules/web-streams-polyfill/README.md +110 -0
  475. package/node_modules/web-streams-polyfill/dist/polyfill.es2018.js +4765 -0
  476. package/node_modules/web-streams-polyfill/dist/polyfill.es2018.js.map +1 -0
  477. package/node_modules/web-streams-polyfill/dist/polyfill.es2018.min.js +9 -0
  478. package/node_modules/web-streams-polyfill/dist/polyfill.es2018.min.js.map +1 -0
  479. package/node_modules/web-streams-polyfill/dist/polyfill.es2018.mjs +4745 -0
  480. package/node_modules/web-streams-polyfill/dist/polyfill.es2018.mjs.map +1 -0
  481. package/node_modules/web-streams-polyfill/dist/polyfill.es6.js +4838 -0
  482. package/node_modules/web-streams-polyfill/dist/polyfill.es6.js.map +1 -0
  483. package/node_modules/web-streams-polyfill/dist/polyfill.es6.min.js +9 -0
  484. package/node_modules/web-streams-polyfill/dist/polyfill.es6.min.js.map +1 -0
  485. package/node_modules/web-streams-polyfill/dist/polyfill.es6.mjs +4818 -0
  486. package/node_modules/web-streams-polyfill/dist/polyfill.es6.mjs.map +1 -0
  487. package/node_modules/web-streams-polyfill/dist/polyfill.js +5011 -0
  488. package/node_modules/web-streams-polyfill/dist/polyfill.js.map +1 -0
  489. package/node_modules/web-streams-polyfill/dist/polyfill.min.js +9 -0
  490. package/node_modules/web-streams-polyfill/dist/polyfill.min.js.map +1 -0
  491. package/node_modules/web-streams-polyfill/dist/polyfill.mjs +4991 -0
  492. package/node_modules/web-streams-polyfill/dist/polyfill.mjs.map +1 -0
  493. package/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js +4737 -0
  494. package/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +1 -0
  495. package/node_modules/web-streams-polyfill/dist/ponyfill.es2018.mjs +4717 -0
  496. package/node_modules/web-streams-polyfill/dist/ponyfill.es2018.mjs.map +1 -0
  497. package/node_modules/web-streams-polyfill/dist/ponyfill.es6.js +4810 -0
  498. package/node_modules/web-streams-polyfill/dist/ponyfill.es6.js.map +1 -0
  499. package/node_modules/web-streams-polyfill/dist/ponyfill.es6.mjs +4790 -0
  500. package/node_modules/web-streams-polyfill/dist/ponyfill.es6.mjs.map +1 -0
  501. package/node_modules/web-streams-polyfill/dist/ponyfill.js +4983 -0
  502. package/node_modules/web-streams-polyfill/dist/ponyfill.js.map +1 -0
  503. package/node_modules/web-streams-polyfill/dist/ponyfill.mjs +4963 -0
  504. package/node_modules/web-streams-polyfill/dist/ponyfill.mjs.map +1 -0
  505. package/node_modules/web-streams-polyfill/dist/types/polyfill.d.ts +24 -0
  506. package/node_modules/web-streams-polyfill/dist/types/ponyfill.d.ts +780 -0
  507. package/node_modules/web-streams-polyfill/dist/types/ts3.6/polyfill.d.ts +28 -0
  508. package/node_modules/web-streams-polyfill/dist/types/ts3.6/ponyfill.d.ts +821 -0
  509. package/node_modules/web-streams-polyfill/dist/types/tsdoc-metadata.json +11 -0
  510. package/node_modules/web-streams-polyfill/es2018/package.json +14 -0
  511. package/node_modules/web-streams-polyfill/es6/package.json +14 -0
  512. package/node_modules/web-streams-polyfill/package.json +83 -0
  513. package/node_modules/web-streams-polyfill/ponyfill/es2018/package.json +13 -0
  514. package/node_modules/web-streams-polyfill/ponyfill/es6/package.json +13 -0
  515. package/node_modules/web-streams-polyfill/ponyfill/package.json +13 -0
  516. package/package.json +26 -0
  517. package/version.json +18 -0
@@ -0,0 +1,1108 @@
1
+ import { expand } from 'brace-expansion';
2
+ import { assertValidPattern } from './assert-valid-pattern.js';
3
+ import { AST } from './ast.js';
4
+ import { escape } from './escape.js';
5
+ import { unescape } from './unescape.js';
6
+ export const minimatch = (p, pattern, options = {}) => {
7
+ assertValidPattern(pattern);
8
+ // shortcut: comments match nothing.
9
+ if (!options.nocomment && pattern.charAt(0) === '#') {
10
+ return false;
11
+ }
12
+ return new Minimatch(pattern, options).match(p);
13
+ };
14
+ // Optimized checking for the most common glob patterns.
15
+ const starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
16
+ const starDotExtTest = (ext) => (f) => !f.startsWith('.') && f.endsWith(ext);
17
+ const starDotExtTestDot = (ext) => (f) => f.endsWith(ext);
18
+ const starDotExtTestNocase = (ext) => {
19
+ ext = ext.toLowerCase();
20
+ return (f) => !f.startsWith('.') && f.toLowerCase().endsWith(ext);
21
+ };
22
+ const starDotExtTestNocaseDot = (ext) => {
23
+ ext = ext.toLowerCase();
24
+ return (f) => f.toLowerCase().endsWith(ext);
25
+ };
26
+ const starDotStarRE = /^\*+\.\*+$/;
27
+ const starDotStarTest = (f) => !f.startsWith('.') && f.includes('.');
28
+ const starDotStarTestDot = (f) => f !== '.' && f !== '..' && f.includes('.');
29
+ const dotStarRE = /^\.\*+$/;
30
+ const dotStarTest = (f) => f !== '.' && f !== '..' && f.startsWith('.');
31
+ const starRE = /^\*+$/;
32
+ const starTest = (f) => f.length !== 0 && !f.startsWith('.');
33
+ const starTestDot = (f) => f.length !== 0 && f !== '.' && f !== '..';
34
+ const qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
35
+ const qmarksTestNocase = ([$0, ext = '']) => {
36
+ const noext = qmarksTestNoExt([$0]);
37
+ if (!ext)
38
+ return noext;
39
+ ext = ext.toLowerCase();
40
+ return (f) => noext(f) && f.toLowerCase().endsWith(ext);
41
+ };
42
+ const qmarksTestNocaseDot = ([$0, ext = '']) => {
43
+ const noext = qmarksTestNoExtDot([$0]);
44
+ if (!ext)
45
+ return noext;
46
+ ext = ext.toLowerCase();
47
+ return (f) => noext(f) && f.toLowerCase().endsWith(ext);
48
+ };
49
+ const qmarksTestDot = ([$0, ext = '']) => {
50
+ const noext = qmarksTestNoExtDot([$0]);
51
+ return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
52
+ };
53
+ const qmarksTest = ([$0, ext = '']) => {
54
+ const noext = qmarksTestNoExt([$0]);
55
+ return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
56
+ };
57
+ const qmarksTestNoExt = ([$0]) => {
58
+ const len = $0.length;
59
+ return (f) => f.length === len && !f.startsWith('.');
60
+ };
61
+ const qmarksTestNoExtDot = ([$0]) => {
62
+ const len = $0.length;
63
+ return (f) => f.length === len && f !== '.' && f !== '..';
64
+ };
65
+ /* c8 ignore start */
66
+ const defaultPlatform = (typeof process === 'object' && process ?
67
+ (typeof process.env === 'object' &&
68
+ process.env &&
69
+ process.env.__MINIMATCH_TESTING_PLATFORM__) ||
70
+ process.platform
71
+ : 'posix');
72
+ const path = {
73
+ win32: { sep: '\\' },
74
+ posix: { sep: '/' },
75
+ };
76
+ /* c8 ignore stop */
77
+ export const sep = defaultPlatform === 'win32' ? path.win32.sep : path.posix.sep;
78
+ minimatch.sep = sep;
79
+ export const GLOBSTAR = Symbol('globstar **');
80
+ minimatch.GLOBSTAR = GLOBSTAR;
81
+ // any single thing other than /
82
+ // don't need to escape / when using new RegExp()
83
+ const qmark = '[^/]';
84
+ // * => any number of characters
85
+ const star = qmark + '*?';
86
+ // ** when dots are allowed. Anything goes, except .. and .
87
+ // not (^ or / followed by one or two dots followed by $ or /),
88
+ // followed by anything, any number of times.
89
+ const twoStarDot = '(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?';
90
+ // not a ^ or / followed by a dot,
91
+ // followed by anything, any number of times.
92
+ const twoStarNoDot = '(?:(?!(?:\\/|^)\\.).)*?';
93
+ export const filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
94
+ minimatch.filter = filter;
95
+ const ext = (a, b = {}) => Object.assign({}, a, b);
96
+ export const defaults = (def) => {
97
+ if (!def || typeof def !== 'object' || !Object.keys(def).length) {
98
+ return minimatch;
99
+ }
100
+ const orig = minimatch;
101
+ const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
102
+ return Object.assign(m, {
103
+ Minimatch: class Minimatch extends orig.Minimatch {
104
+ constructor(pattern, options = {}) {
105
+ super(pattern, ext(def, options));
106
+ }
107
+ static defaults(options) {
108
+ return orig.defaults(ext(def, options)).Minimatch;
109
+ }
110
+ },
111
+ AST: class AST extends orig.AST {
112
+ /* c8 ignore start */
113
+ constructor(type, parent, options = {}) {
114
+ super(type, parent, ext(def, options));
115
+ }
116
+ /* c8 ignore stop */
117
+ static fromGlob(pattern, options = {}) {
118
+ return orig.AST.fromGlob(pattern, ext(def, options));
119
+ }
120
+ },
121
+ unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
122
+ escape: (s, options = {}) => orig.escape(s, ext(def, options)),
123
+ filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
124
+ defaults: (options) => orig.defaults(ext(def, options)),
125
+ makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
126
+ braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
127
+ match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
128
+ sep: orig.sep,
129
+ GLOBSTAR: GLOBSTAR,
130
+ });
131
+ };
132
+ minimatch.defaults = defaults;
133
+ // Brace expansion:
134
+ // a{b,c}d -> abd acd
135
+ // a{b,}c -> abc ac
136
+ // a{0..3}d -> a0d a1d a2d a3d
137
+ // a{b,c{d,e}f}g -> abg acdfg acefg
138
+ // a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
139
+ //
140
+ // Invalid sets are not expanded.
141
+ // a{2..}b -> a{2..}b
142
+ // a{b}c -> a{b}c
143
+ export const braceExpand = (pattern, options = {}) => {
144
+ assertValidPattern(pattern);
145
+ // Thanks to Yeting Li <https://github.com/yetingli> for
146
+ // improving this regexp to avoid a ReDOS vulnerability.
147
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
148
+ // shortcut. no need to expand.
149
+ return [pattern];
150
+ }
151
+ return expand(pattern, { max: options.braceExpandMax });
152
+ };
153
+ minimatch.braceExpand = braceExpand;
154
+ // parse a component of the expanded set.
155
+ // At this point, no pattern may contain "/" in it
156
+ // so we're going to return a 2d array, where each entry is the full
157
+ // pattern, split on '/', and then turned into a regular expression.
158
+ // A regexp is made at the end which joins each array with an
159
+ // escaped /, and another full one which joins each regexp with |.
160
+ //
161
+ // Following the lead of Bash 4.1, note that "**" only has special meaning
162
+ // when it is the *only* thing in a path portion. Otherwise, any series
163
+ // of * is equivalent to a single *. Globstar behavior is enabled by
164
+ // default, and can be disabled by setting options.noglobstar.
165
+ export const makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
166
+ minimatch.makeRe = makeRe;
167
+ export const match = (list, pattern, options = {}) => {
168
+ const mm = new Minimatch(pattern, options);
169
+ list = list.filter(f => mm.match(f));
170
+ if (mm.options.nonull && !list.length) {
171
+ list.push(pattern);
172
+ }
173
+ return list;
174
+ };
175
+ minimatch.match = match;
176
+ // replace stuff like \* with *
177
+ const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
178
+ const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
179
+ export class Minimatch {
180
+ options;
181
+ set;
182
+ pattern;
183
+ windowsPathsNoEscape;
184
+ nonegate;
185
+ negate;
186
+ comment;
187
+ empty;
188
+ preserveMultipleSlashes;
189
+ partial;
190
+ globSet;
191
+ globParts;
192
+ nocase;
193
+ isWindows;
194
+ platform;
195
+ windowsNoMagicRoot;
196
+ maxGlobstarRecursion;
197
+ regexp;
198
+ constructor(pattern, options = {}) {
199
+ assertValidPattern(pattern);
200
+ options = options || {};
201
+ this.options = options;
202
+ this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
203
+ this.pattern = pattern;
204
+ this.platform = options.platform || defaultPlatform;
205
+ this.isWindows = this.platform === 'win32';
206
+ // avoid the annoying deprecation flag lol
207
+ const awe = ('allowWindow' + 'sEscape');
208
+ this.windowsPathsNoEscape =
209
+ !!options.windowsPathsNoEscape || options[awe] === false;
210
+ if (this.windowsPathsNoEscape) {
211
+ this.pattern = this.pattern.replace(/\\/g, '/');
212
+ }
213
+ this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
214
+ this.regexp = null;
215
+ this.negate = false;
216
+ this.nonegate = !!options.nonegate;
217
+ this.comment = false;
218
+ this.empty = false;
219
+ this.partial = !!options.partial;
220
+ this.nocase = !!this.options.nocase;
221
+ this.windowsNoMagicRoot =
222
+ options.windowsNoMagicRoot !== undefined ?
223
+ options.windowsNoMagicRoot
224
+ : !!(this.isWindows && this.nocase);
225
+ this.globSet = [];
226
+ this.globParts = [];
227
+ this.set = [];
228
+ // make the set of regexps etc.
229
+ this.make();
230
+ }
231
+ hasMagic() {
232
+ if (this.options.magicalBraces && this.set.length > 1) {
233
+ return true;
234
+ }
235
+ for (const pattern of this.set) {
236
+ for (const part of pattern) {
237
+ if (typeof part !== 'string')
238
+ return true;
239
+ }
240
+ }
241
+ return false;
242
+ }
243
+ debug(..._) { }
244
+ make() {
245
+ const pattern = this.pattern;
246
+ const options = this.options;
247
+ // empty patterns and comments match nothing.
248
+ if (!options.nocomment && pattern.charAt(0) === '#') {
249
+ this.comment = true;
250
+ return;
251
+ }
252
+ if (!pattern) {
253
+ this.empty = true;
254
+ return;
255
+ }
256
+ // step 1: figure out negation, etc.
257
+ this.parseNegate();
258
+ // step 2: expand braces
259
+ this.globSet = [...new Set(this.braceExpand())];
260
+ if (options.debug) {
261
+ this.debug = (...args) => console.error(...args);
262
+ }
263
+ this.debug(this.pattern, this.globSet);
264
+ // step 3: now we have a set, so turn each one into a series of
265
+ // path-portion matching patterns.
266
+ // These will be regexps, except in the case of "**", which is
267
+ // set to the GLOBSTAR object for globstar behavior,
268
+ // and will not contain any / characters
269
+ //
270
+ // First, we preprocess to make the glob pattern sets a bit simpler
271
+ // and deduped. There are some perf-killing patterns that can cause
272
+ // problems with a glob walk, but we can simplify them down a bit.
273
+ const rawGlobParts = this.globSet.map(s => this.slashSplit(s));
274
+ this.globParts = this.preprocess(rawGlobParts);
275
+ this.debug(this.pattern, this.globParts);
276
+ // glob --> regexps
277
+ let set = this.globParts.map((s, _, __) => {
278
+ if (this.isWindows && this.windowsNoMagicRoot) {
279
+ // check if it's a drive or unc path.
280
+ const isUNC = s[0] === '' &&
281
+ s[1] === '' &&
282
+ (s[2] === '?' || !globMagic.test(s[2])) &&
283
+ !globMagic.test(s[3]);
284
+ const isDrive = /^[a-z]:/i.test(s[0]);
285
+ if (isUNC) {
286
+ return [
287
+ ...s.slice(0, 4),
288
+ ...s.slice(4).map(ss => this.parse(ss)),
289
+ ];
290
+ }
291
+ else if (isDrive) {
292
+ return [s[0], ...s.slice(1).map(ss => this.parse(ss))];
293
+ }
294
+ }
295
+ return s.map(ss => this.parse(ss));
296
+ });
297
+ this.debug(this.pattern, set);
298
+ // filter out everything that didn't compile properly.
299
+ this.set = set.filter(s => s.indexOf(false) === -1);
300
+ // do not treat the ? in UNC paths as magic
301
+ if (this.isWindows) {
302
+ for (let i = 0; i < this.set.length; i++) {
303
+ const p = this.set[i];
304
+ if (p[0] === '' &&
305
+ p[1] === '' &&
306
+ this.globParts[i][2] === '?' &&
307
+ typeof p[3] === 'string' &&
308
+ /^[a-z]:$/i.test(p[3])) {
309
+ p[2] = '?';
310
+ }
311
+ }
312
+ }
313
+ this.debug(this.pattern, this.set);
314
+ }
315
+ // various transforms to equivalent pattern sets that are
316
+ // faster to process in a filesystem walk. The goal is to
317
+ // eliminate what we can, and push all ** patterns as far
318
+ // to the right as possible, even if it increases the number
319
+ // of patterns that we have to process.
320
+ preprocess(globParts) {
321
+ // if we're not in globstar mode, then turn ** into *
322
+ if (this.options.noglobstar) {
323
+ for (let i = 0; i < globParts.length; i++) {
324
+ for (let j = 0; j < globParts[i].length; j++) {
325
+ if (globParts[i][j] === '**') {
326
+ globParts[i][j] = '*';
327
+ }
328
+ }
329
+ }
330
+ }
331
+ const { optimizationLevel = 1 } = this.options;
332
+ if (optimizationLevel >= 2) {
333
+ // aggressive optimization for the purpose of fs walking
334
+ globParts = this.firstPhasePreProcess(globParts);
335
+ globParts = this.secondPhasePreProcess(globParts);
336
+ }
337
+ else if (optimizationLevel >= 1) {
338
+ // just basic optimizations to remove some .. parts
339
+ globParts = this.levelOneOptimize(globParts);
340
+ }
341
+ else {
342
+ // just collapse multiple ** portions into one
343
+ globParts = this.adjascentGlobstarOptimize(globParts);
344
+ }
345
+ return globParts;
346
+ }
347
+ // just get rid of adjascent ** portions
348
+ adjascentGlobstarOptimize(globParts) {
349
+ return globParts.map(parts => {
350
+ let gs = -1;
351
+ while (-1 !== (gs = parts.indexOf('**', gs + 1))) {
352
+ let i = gs;
353
+ while (parts[i + 1] === '**') {
354
+ i++;
355
+ }
356
+ if (i !== gs) {
357
+ parts.splice(gs, i - gs);
358
+ }
359
+ }
360
+ return parts;
361
+ });
362
+ }
363
+ // get rid of adjascent ** and resolve .. portions
364
+ levelOneOptimize(globParts) {
365
+ return globParts.map(parts => {
366
+ parts = parts.reduce((set, part) => {
367
+ const prev = set[set.length - 1];
368
+ if (part === '**' && prev === '**') {
369
+ return set;
370
+ }
371
+ if (part === '..') {
372
+ if (prev && prev !== '..' && prev !== '.' && prev !== '**') {
373
+ set.pop();
374
+ return set;
375
+ }
376
+ }
377
+ set.push(part);
378
+ return set;
379
+ }, []);
380
+ return parts.length === 0 ? [''] : parts;
381
+ });
382
+ }
383
+ levelTwoFileOptimize(parts) {
384
+ if (!Array.isArray(parts)) {
385
+ parts = this.slashSplit(parts);
386
+ }
387
+ let didSomething = false;
388
+ do {
389
+ didSomething = false;
390
+ // <pre>/<e>/<rest> -> <pre>/<rest>
391
+ if (!this.preserveMultipleSlashes) {
392
+ for (let i = 1; i < parts.length - 1; i++) {
393
+ const p = parts[i];
394
+ // don't squeeze out UNC patterns
395
+ if (i === 1 && p === '' && parts[0] === '')
396
+ continue;
397
+ if (p === '.' || p === '') {
398
+ didSomething = true;
399
+ parts.splice(i, 1);
400
+ i--;
401
+ }
402
+ }
403
+ if (parts[0] === '.' &&
404
+ parts.length === 2 &&
405
+ (parts[1] === '.' || parts[1] === '')) {
406
+ didSomething = true;
407
+ parts.pop();
408
+ }
409
+ }
410
+ // <pre>/<p>/../<rest> -> <pre>/<rest>
411
+ let dd = 0;
412
+ while (-1 !== (dd = parts.indexOf('..', dd + 1))) {
413
+ const p = parts[dd - 1];
414
+ if (p && p !== '.' && p !== '..' && p !== '**') {
415
+ didSomething = true;
416
+ parts.splice(dd - 1, 2);
417
+ dd -= 2;
418
+ }
419
+ }
420
+ } while (didSomething);
421
+ return parts.length === 0 ? [''] : parts;
422
+ }
423
+ // First phase: single-pattern processing
424
+ // <pre> is 1 or more portions
425
+ // <rest> is 1 or more portions
426
+ // <p> is any portion other than ., .., '', or **
427
+ // <e> is . or ''
428
+ //
429
+ // **/.. is *brutal* for filesystem walking performance, because
430
+ // it effectively resets the recursive walk each time it occurs,
431
+ // and ** cannot be reduced out by a .. pattern part like a regexp
432
+ // or most strings (other than .., ., and '') can be.
433
+ //
434
+ // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
435
+ // <pre>/<e>/<rest> -> <pre>/<rest>
436
+ // <pre>/<p>/../<rest> -> <pre>/<rest>
437
+ // **/**/<rest> -> **/<rest>
438
+ //
439
+ // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
440
+ // this WOULD be allowed if ** did follow symlinks, or * didn't
441
+ firstPhasePreProcess(globParts) {
442
+ let didSomething = false;
443
+ do {
444
+ didSomething = false;
445
+ // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
446
+ for (let parts of globParts) {
447
+ let gs = -1;
448
+ while (-1 !== (gs = parts.indexOf('**', gs + 1))) {
449
+ let gss = gs;
450
+ while (parts[gss + 1] === '**') {
451
+ // <pre>/**/**/<rest> -> <pre>/**/<rest>
452
+ gss++;
453
+ }
454
+ // eg, if gs is 2 and gss is 4, that means we have 3 **
455
+ // parts, and can remove 2 of them.
456
+ if (gss > gs) {
457
+ parts.splice(gs + 1, gss - gs);
458
+ }
459
+ let next = parts[gs + 1];
460
+ const p = parts[gs + 2];
461
+ const p2 = parts[gs + 3];
462
+ if (next !== '..')
463
+ continue;
464
+ if (!p ||
465
+ p === '.' ||
466
+ p === '..' ||
467
+ !p2 ||
468
+ p2 === '.' ||
469
+ p2 === '..') {
470
+ continue;
471
+ }
472
+ didSomething = true;
473
+ // edit parts in place, and push the new one
474
+ parts.splice(gs, 1);
475
+ const other = parts.slice(0);
476
+ other[gs] = '**';
477
+ globParts.push(other);
478
+ gs--;
479
+ }
480
+ // <pre>/<e>/<rest> -> <pre>/<rest>
481
+ if (!this.preserveMultipleSlashes) {
482
+ for (let i = 1; i < parts.length - 1; i++) {
483
+ const p = parts[i];
484
+ // don't squeeze out UNC patterns
485
+ if (i === 1 && p === '' && parts[0] === '')
486
+ continue;
487
+ if (p === '.' || p === '') {
488
+ didSomething = true;
489
+ parts.splice(i, 1);
490
+ i--;
491
+ }
492
+ }
493
+ if (parts[0] === '.' &&
494
+ parts.length === 2 &&
495
+ (parts[1] === '.' || parts[1] === '')) {
496
+ didSomething = true;
497
+ parts.pop();
498
+ }
499
+ }
500
+ // <pre>/<p>/../<rest> -> <pre>/<rest>
501
+ let dd = 0;
502
+ while (-1 !== (dd = parts.indexOf('..', dd + 1))) {
503
+ const p = parts[dd - 1];
504
+ if (p && p !== '.' && p !== '..' && p !== '**') {
505
+ didSomething = true;
506
+ const needDot = dd === 1 && parts[dd + 1] === '**';
507
+ const splin = needDot ? ['.'] : [];
508
+ parts.splice(dd - 1, 2, ...splin);
509
+ if (parts.length === 0)
510
+ parts.push('');
511
+ dd -= 2;
512
+ }
513
+ }
514
+ }
515
+ } while (didSomething);
516
+ return globParts;
517
+ }
518
+ // second phase: multi-pattern dedupes
519
+ // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
520
+ // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
521
+ // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
522
+ //
523
+ // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
524
+ // ^-- not valid because ** doens't follow symlinks
525
+ secondPhasePreProcess(globParts) {
526
+ for (let i = 0; i < globParts.length - 1; i++) {
527
+ for (let j = i + 1; j < globParts.length; j++) {
528
+ const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
529
+ if (matched) {
530
+ globParts[i] = [];
531
+ globParts[j] = matched;
532
+ break;
533
+ }
534
+ }
535
+ }
536
+ return globParts.filter(gs => gs.length);
537
+ }
538
+ partsMatch(a, b, emptyGSMatch = false) {
539
+ let ai = 0;
540
+ let bi = 0;
541
+ let result = [];
542
+ let which = '';
543
+ while (ai < a.length && bi < b.length) {
544
+ if (a[ai] === b[bi]) {
545
+ result.push(which === 'b' ? b[bi] : a[ai]);
546
+ ai++;
547
+ bi++;
548
+ }
549
+ else if (emptyGSMatch && a[ai] === '**' && b[bi] === a[ai + 1]) {
550
+ result.push(a[ai]);
551
+ ai++;
552
+ }
553
+ else if (emptyGSMatch && b[bi] === '**' && a[ai] === b[bi + 1]) {
554
+ result.push(b[bi]);
555
+ bi++;
556
+ }
557
+ else if (a[ai] === '*' &&
558
+ b[bi] &&
559
+ (this.options.dot || !b[bi].startsWith('.')) &&
560
+ b[bi] !== '**') {
561
+ if (which === 'b')
562
+ return false;
563
+ which = 'a';
564
+ result.push(a[ai]);
565
+ ai++;
566
+ bi++;
567
+ }
568
+ else if (b[bi] === '*' &&
569
+ a[ai] &&
570
+ (this.options.dot || !a[ai].startsWith('.')) &&
571
+ a[ai] !== '**') {
572
+ if (which === 'a')
573
+ return false;
574
+ which = 'b';
575
+ result.push(b[bi]);
576
+ ai++;
577
+ bi++;
578
+ }
579
+ else {
580
+ return false;
581
+ }
582
+ }
583
+ // if we fall out of the loop, it means they two are identical
584
+ // as long as their lengths match
585
+ return a.length === b.length && result;
586
+ }
587
+ parseNegate() {
588
+ if (this.nonegate)
589
+ return;
590
+ const pattern = this.pattern;
591
+ let negate = false;
592
+ let negateOffset = 0;
593
+ for (let i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) {
594
+ negate = !negate;
595
+ negateOffset++;
596
+ }
597
+ if (negateOffset)
598
+ this.pattern = pattern.slice(negateOffset);
599
+ this.negate = negate;
600
+ }
601
+ // set partial to true to test if, for example,
602
+ // "/a/b" matches the start of "/*/b/*/d"
603
+ // Partial means, if you run out of file before you run
604
+ // out of pattern, then that's fine, as long as all
605
+ // the parts match.
606
+ matchOne(file, pattern, partial = false) {
607
+ let fileStartIndex = 0;
608
+ let patternStartIndex = 0;
609
+ // UNC paths like //?/X:/... can match X:/... and vice versa
610
+ // Drive letters in absolute drive or unc paths are always compared
611
+ // case-insensitively.
612
+ if (this.isWindows) {
613
+ const fileDrive = typeof file[0] === 'string' && /^[a-z]:$/i.test(file[0]);
614
+ const fileUNC = !fileDrive &&
615
+ file[0] === '' &&
616
+ file[1] === '' &&
617
+ file[2] === '?' &&
618
+ /^[a-z]:$/i.test(file[3]);
619
+ const patternDrive = typeof pattern[0] === 'string' && /^[a-z]:$/i.test(pattern[0]);
620
+ const patternUNC = !patternDrive &&
621
+ pattern[0] === '' &&
622
+ pattern[1] === '' &&
623
+ pattern[2] === '?' &&
624
+ typeof pattern[3] === 'string' &&
625
+ /^[a-z]:$/i.test(pattern[3]);
626
+ const fdi = fileUNC ? 3
627
+ : fileDrive ? 0
628
+ : undefined;
629
+ const pdi = patternUNC ? 3
630
+ : patternDrive ? 0
631
+ : undefined;
632
+ if (typeof fdi === 'number' && typeof pdi === 'number') {
633
+ const [fd, pd] = [
634
+ file[fdi],
635
+ pattern[pdi],
636
+ ];
637
+ // start matching at the drive letter index of each
638
+ if (fd.toLowerCase() === pd.toLowerCase()) {
639
+ pattern[pdi] = fd;
640
+ patternStartIndex = pdi;
641
+ fileStartIndex = fdi;
642
+ }
643
+ }
644
+ }
645
+ // resolve and reduce . and .. portions in the file as well.
646
+ // don't need to do the second phase, because it's only one string[]
647
+ const { optimizationLevel = 1 } = this.options;
648
+ if (optimizationLevel >= 2) {
649
+ file = this.levelTwoFileOptimize(file);
650
+ }
651
+ if (pattern.includes(GLOBSTAR)) {
652
+ return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
653
+ }
654
+ return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
655
+ }
656
+ #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
657
+ // split the pattern into head, tail, and middle of ** delimited parts
658
+ const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
659
+ const lastgs = pattern.lastIndexOf(GLOBSTAR);
660
+ // split the pattern up into globstar-delimited sections
661
+ // the tail has to be at the end, and the others just have
662
+ // to be found in order from the head.
663
+ const [head, body, tail] = partial ? [
664
+ pattern.slice(patternIndex, firstgs),
665
+ pattern.slice(firstgs + 1),
666
+ [],
667
+ ] : [
668
+ pattern.slice(patternIndex, firstgs),
669
+ pattern.slice(firstgs + 1, lastgs),
670
+ pattern.slice(lastgs + 1),
671
+ ];
672
+ // check the head, from the current file/pattern index.
673
+ if (head.length) {
674
+ const fileHead = file.slice(fileIndex, fileIndex + head.length);
675
+ if (!this.#matchOne(fileHead, head, partial, 0, 0)) {
676
+ return false;
677
+ }
678
+ fileIndex += head.length;
679
+ patternIndex += head.length;
680
+ }
681
+ // now we know the head matches!
682
+ // if the last portion is not empty, it MUST match the end
683
+ // check the tail
684
+ let fileTailMatch = 0;
685
+ if (tail.length) {
686
+ // if head + tail > file, then we cannot possibly match
687
+ if (tail.length + fileIndex > file.length)
688
+ return false;
689
+ // try to match the tail
690
+ let tailStart = file.length - tail.length;
691
+ if (this.#matchOne(file, tail, partial, tailStart, 0)) {
692
+ fileTailMatch = tail.length;
693
+ }
694
+ else {
695
+ // affordance for stuff like a/**/* matching a/b/
696
+ // if the last file portion is '', and there's more to the pattern
697
+ // then try without the '' bit.
698
+ if (file[file.length - 1] !== '' ||
699
+ fileIndex + tail.length === file.length) {
700
+ return false;
701
+ }
702
+ tailStart--;
703
+ if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
704
+ return false;
705
+ }
706
+ fileTailMatch = tail.length + 1;
707
+ }
708
+ }
709
+ // now we know the tail matches!
710
+ // the middle is zero or more portions wrapped in **, possibly
711
+ // containing more ** sections.
712
+ // so a/**/b/**/c/**/d has become **/b/**/c/**
713
+ // if it's empty, it means a/**/b, just verify we have no bad dots
714
+ // if there's no tail, so it ends on /**, then we must have *something*
715
+ // after the head, or it's not a matc
716
+ if (!body.length) {
717
+ let sawSome = !!fileTailMatch;
718
+ for (let i = fileIndex; i < file.length - fileTailMatch; i++) {
719
+ const f = String(file[i]);
720
+ sawSome = true;
721
+ if (f === '.' ||
722
+ f === '..' ||
723
+ (!this.options.dot && f.startsWith('.'))) {
724
+ return false;
725
+ }
726
+ }
727
+ // in partial mode, we just need to get past all file parts
728
+ return partial || sawSome;
729
+ }
730
+ // now we know that there's one or more body sections, which can
731
+ // be matched anywhere from the 0 index (because the head was pruned)
732
+ // through to the length-fileTailMatch index.
733
+ // split the body up into sections, and note the minimum index it can
734
+ // be found at (start with the length of all previous segments)
735
+ // [section, before, after]
736
+ const bodySegments = [[[], 0]];
737
+ let currentBody = bodySegments[0];
738
+ let nonGsParts = 0;
739
+ const nonGsPartsSums = [0];
740
+ for (const b of body) {
741
+ if (b === GLOBSTAR) {
742
+ nonGsPartsSums.push(nonGsParts);
743
+ currentBody = [[], 0];
744
+ bodySegments.push(currentBody);
745
+ }
746
+ else {
747
+ currentBody[0].push(b);
748
+ nonGsParts++;
749
+ }
750
+ }
751
+ let i = bodySegments.length - 1;
752
+ const fileLength = file.length - fileTailMatch;
753
+ for (const b of bodySegments) {
754
+ b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
755
+ }
756
+ return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
757
+ }
758
+ // return false for "nope, not matching"
759
+ // return null for "not matching, cannot keep trying"
760
+ #matchGlobStarBodySections(file,
761
+ // pattern section, last possible position for it
762
+ bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
763
+ // take the first body segment, and walk from fileIndex to its "after"
764
+ // value at the end
765
+ // If it doesn't match at that position, we increment, until we hit
766
+ // that final possible position, and give up.
767
+ // If it does match, then advance and try to rest.
768
+ // If any of them fail we keep walking forward.
769
+ // this is still a bit recursively painful, but it's more constrained
770
+ // than previous implementations, because we never test something that
771
+ // can't possibly be a valid matching condition.
772
+ const bs = bodySegments[bodyIndex];
773
+ if (!bs) {
774
+ // just make sure that there's no bad dots
775
+ for (let i = fileIndex; i < file.length; i++) {
776
+ sawTail = true;
777
+ const f = file[i];
778
+ if (f === '.' ||
779
+ f === '..' ||
780
+ (!this.options.dot && f.startsWith('.'))) {
781
+ return false;
782
+ }
783
+ }
784
+ return sawTail;
785
+ }
786
+ // have a non-globstar body section to test
787
+ const [body, after] = bs;
788
+ while (fileIndex <= after) {
789
+ const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
790
+ // if limit exceeded, no match. intentional false negative,
791
+ // acceptable break in correctness for security.
792
+ if (m && globStarDepth < this.maxGlobstarRecursion) {
793
+ // match! see if the rest match. if so, we're done!
794
+ const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
795
+ if (sub !== false) {
796
+ return sub;
797
+ }
798
+ }
799
+ const f = file[fileIndex];
800
+ if (f === '.' ||
801
+ f === '..' ||
802
+ (!this.options.dot && f.startsWith('.'))) {
803
+ return false;
804
+ }
805
+ fileIndex++;
806
+ }
807
+ // walked off. no point continuing
808
+ return partial || null;
809
+ }
810
+ #matchOne(file, pattern, partial, fileIndex, patternIndex) {
811
+ let fi;
812
+ let pi;
813
+ let pl;
814
+ let fl;
815
+ for (fi = fileIndex,
816
+ pi = patternIndex,
817
+ fl = file.length,
818
+ pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
819
+ this.debug('matchOne loop');
820
+ let p = pattern[pi];
821
+ let f = file[fi];
822
+ this.debug(pattern, p, f);
823
+ // should be impossible.
824
+ // some invalid regexp stuff in the set.
825
+ /* c8 ignore start */
826
+ if (p === false || p === GLOBSTAR) {
827
+ return false;
828
+ }
829
+ /* c8 ignore stop */
830
+ // something other than **
831
+ // non-magic patterns just have to match exactly
832
+ // patterns with magic have been turned into regexps.
833
+ let hit;
834
+ if (typeof p === 'string') {
835
+ hit = f === p;
836
+ this.debug('string match', p, f, hit);
837
+ }
838
+ else {
839
+ hit = p.test(f);
840
+ this.debug('pattern match', p, f, hit);
841
+ }
842
+ if (!hit)
843
+ return false;
844
+ }
845
+ // Note: ending in / means that we'll get a final ""
846
+ // at the end of the pattern. This can only match a
847
+ // corresponding "" at the end of the file.
848
+ // If the file ends in /, then it can only match a
849
+ // a pattern that ends in /, unless the pattern just
850
+ // doesn't have any more for it. But, a/b/ should *not*
851
+ // match "a/b/*", even though "" matches against the
852
+ // [^/]*? pattern, except in partial mode, where it might
853
+ // simply not be reached yet.
854
+ // However, a/b/ should still satisfy a/*
855
+ // now either we fell off the end of the pattern, or we're done.
856
+ if (fi === fl && pi === pl) {
857
+ // ran out of pattern and filename at the same time.
858
+ // an exact hit!
859
+ return true;
860
+ }
861
+ else if (fi === fl) {
862
+ // ran out of file, but still had pattern left.
863
+ // this is ok if we're doing the match as part of
864
+ // a glob fs traversal.
865
+ return partial;
866
+ }
867
+ else if (pi === pl) {
868
+ // ran out of pattern, still have file left.
869
+ // this is only acceptable if we're on the very last
870
+ // empty segment of a file with a trailing slash.
871
+ // a/* should match a/b/
872
+ return fi === fl - 1 && file[fi] === '';
873
+ /* c8 ignore start */
874
+ }
875
+ else {
876
+ // should be unreachable.
877
+ throw new Error('wtf?');
878
+ }
879
+ /* c8 ignore stop */
880
+ }
881
+ braceExpand() {
882
+ return braceExpand(this.pattern, this.options);
883
+ }
884
+ parse(pattern) {
885
+ assertValidPattern(pattern);
886
+ const options = this.options;
887
+ // shortcuts
888
+ if (pattern === '**')
889
+ return GLOBSTAR;
890
+ if (pattern === '')
891
+ return '';
892
+ // far and away, the most common glob pattern parts are
893
+ // *, *.*, and *.<ext> Add a fast check method for those.
894
+ let m;
895
+ let fastTest = null;
896
+ if ((m = pattern.match(starRE))) {
897
+ fastTest = options.dot ? starTestDot : starTest;
898
+ }
899
+ else if ((m = pattern.match(starDotExtRE))) {
900
+ fastTest = (options.nocase ?
901
+ options.dot ?
902
+ starDotExtTestNocaseDot
903
+ : starDotExtTestNocase
904
+ : options.dot ? starDotExtTestDot
905
+ : starDotExtTest)(m[1]);
906
+ }
907
+ else if ((m = pattern.match(qmarksRE))) {
908
+ fastTest = (options.nocase ?
909
+ options.dot ?
910
+ qmarksTestNocaseDot
911
+ : qmarksTestNocase
912
+ : options.dot ? qmarksTestDot
913
+ : qmarksTest)(m);
914
+ }
915
+ else if ((m = pattern.match(starDotStarRE))) {
916
+ fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
917
+ }
918
+ else if ((m = pattern.match(dotStarRE))) {
919
+ fastTest = dotStarTest;
920
+ }
921
+ const re = AST.fromGlob(pattern, this.options).toMMPattern();
922
+ if (fastTest && typeof re === 'object') {
923
+ // Avoids overriding in frozen environments
924
+ Reflect.defineProperty(re, 'test', { value: fastTest });
925
+ }
926
+ return re;
927
+ }
928
+ makeRe() {
929
+ if (this.regexp || this.regexp === false)
930
+ return this.regexp;
931
+ // at this point, this.set is a 2d array of partial
932
+ // pattern strings, or "**".
933
+ //
934
+ // It's better to use .match(). This function shouldn't
935
+ // be used, really, but it's pretty convenient sometimes,
936
+ // when you just want to work with a regex.
937
+ const set = this.set;
938
+ if (!set.length) {
939
+ this.regexp = false;
940
+ return this.regexp;
941
+ }
942
+ const options = this.options;
943
+ const twoStar = options.noglobstar ? star
944
+ : options.dot ? twoStarDot
945
+ : twoStarNoDot;
946
+ const flags = new Set(options.nocase ? ['i'] : []);
947
+ // regexpify non-globstar patterns
948
+ // if ** is only item, then we just do one twoStar
949
+ // if ** is first, and there are more, prepend (\/|twoStar\/)? to next
950
+ // if ** is last, append (\/twoStar|) to previous
951
+ // if ** is in the middle, append (\/|\/twoStar\/) to previous
952
+ // then filter out GLOBSTAR symbols
953
+ let re = set
954
+ .map(pattern => {
955
+ const pp = pattern.map(p => {
956
+ if (p instanceof RegExp) {
957
+ for (const f of p.flags.split(''))
958
+ flags.add(f);
959
+ }
960
+ return (typeof p === 'string' ? regExpEscape(p)
961
+ : p === GLOBSTAR ? GLOBSTAR
962
+ : p._src);
963
+ });
964
+ pp.forEach((p, i) => {
965
+ const next = pp[i + 1];
966
+ const prev = pp[i - 1];
967
+ if (p !== GLOBSTAR || prev === GLOBSTAR) {
968
+ return;
969
+ }
970
+ if (prev === undefined) {
971
+ if (next !== undefined && next !== GLOBSTAR) {
972
+ pp[i + 1] = '(?:\\/|' + twoStar + '\\/)?' + next;
973
+ }
974
+ else {
975
+ pp[i] = twoStar;
976
+ }
977
+ }
978
+ else if (next === undefined) {
979
+ pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + ')?';
980
+ }
981
+ else if (next !== GLOBSTAR) {
982
+ pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + '\\/)' + next;
983
+ pp[i + 1] = GLOBSTAR;
984
+ }
985
+ });
986
+ const filtered = pp.filter(p => p !== GLOBSTAR);
987
+ // For partial matches, we need to make the pattern match
988
+ // any prefix of the full path. We do this by generating
989
+ // alternative patterns that match progressively longer prefixes.
990
+ if (this.partial && filtered.length >= 1) {
991
+ const prefixes = [];
992
+ for (let i = 1; i <= filtered.length; i++) {
993
+ prefixes.push(filtered.slice(0, i).join('/'));
994
+ }
995
+ return '(?:' + prefixes.join('|') + ')';
996
+ }
997
+ return filtered.join('/');
998
+ })
999
+ .join('|');
1000
+ // need to wrap in parens if we had more than one thing with |,
1001
+ // otherwise only the first will be anchored to ^ and the last to $
1002
+ const [open, close] = set.length > 1 ? ['(?:', ')'] : ['', ''];
1003
+ // must match entire pattern
1004
+ // ending in a * or ** will make it less strict.
1005
+ re = '^' + open + re + close + '$';
1006
+ // In partial mode, '/' should always match as it's a valid prefix for any pattern
1007
+ if (this.partial) {
1008
+ re = '^(?:\\/|' + open + re.slice(1, -1) + close + ')$';
1009
+ }
1010
+ // can match anything, as long as it's not this.
1011
+ if (this.negate)
1012
+ re = '^(?!' + re + ').+$';
1013
+ try {
1014
+ this.regexp = new RegExp(re, [...flags].join(''));
1015
+ /* c8 ignore start */
1016
+ }
1017
+ catch (ex) {
1018
+ // should be impossible
1019
+ this.regexp = false;
1020
+ }
1021
+ /* c8 ignore stop */
1022
+ return this.regexp;
1023
+ }
1024
+ slashSplit(p) {
1025
+ // if p starts with // on windows, we preserve that
1026
+ // so that UNC paths aren't broken. Otherwise, any number of
1027
+ // / characters are coalesced into one, unless
1028
+ // preserveMultipleSlashes is set to true.
1029
+ if (this.preserveMultipleSlashes) {
1030
+ return p.split('/');
1031
+ }
1032
+ else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
1033
+ // add an extra '' for the one we lose
1034
+ return ['', ...p.split(/\/+/)];
1035
+ }
1036
+ else {
1037
+ return p.split(/\/+/);
1038
+ }
1039
+ }
1040
+ match(f, partial = this.partial) {
1041
+ this.debug('match', f, this.pattern);
1042
+ // short-circuit in the case of busted things.
1043
+ // comments, etc.
1044
+ if (this.comment) {
1045
+ return false;
1046
+ }
1047
+ if (this.empty) {
1048
+ return f === '';
1049
+ }
1050
+ if (f === '/' && partial) {
1051
+ return true;
1052
+ }
1053
+ const options = this.options;
1054
+ // windows: need to use /, not \
1055
+ if (this.isWindows) {
1056
+ f = f.split('\\').join('/');
1057
+ }
1058
+ // treat the test path as a set of pathparts.
1059
+ const ff = this.slashSplit(f);
1060
+ this.debug(this.pattern, 'split', ff);
1061
+ // just ONE of the pattern sets in this.set needs to match
1062
+ // in order for it to be valid. If negating, then just one
1063
+ // match means that we have failed.
1064
+ // Either way, return on the first hit.
1065
+ const set = this.set;
1066
+ this.debug(this.pattern, 'set', set);
1067
+ // Find the basename of the path by looking for the last non-empty segment
1068
+ let filename = ff[ff.length - 1];
1069
+ if (!filename) {
1070
+ for (let i = ff.length - 2; !filename && i >= 0; i--) {
1071
+ filename = ff[i];
1072
+ }
1073
+ }
1074
+ for (let i = 0; i < set.length; i++) {
1075
+ const pattern = set[i];
1076
+ let file = ff;
1077
+ if (options.matchBase && pattern.length === 1) {
1078
+ file = [filename];
1079
+ }
1080
+ const hit = this.matchOne(file, pattern, partial);
1081
+ if (hit) {
1082
+ if (options.flipNegate) {
1083
+ return true;
1084
+ }
1085
+ return !this.negate;
1086
+ }
1087
+ }
1088
+ // didn't get any hits. this is success if it's a negative
1089
+ // pattern, failure otherwise.
1090
+ if (options.flipNegate) {
1091
+ return false;
1092
+ }
1093
+ return this.negate;
1094
+ }
1095
+ static defaults(def) {
1096
+ return minimatch.defaults(def).Minimatch;
1097
+ }
1098
+ }
1099
+ /* c8 ignore start */
1100
+ export { AST } from './ast.js';
1101
+ export { escape } from './escape.js';
1102
+ export { unescape } from './unescape.js';
1103
+ /* c8 ignore stop */
1104
+ minimatch.AST = AST;
1105
+ minimatch.Minimatch = Minimatch;
1106
+ minimatch.escape = escape;
1107
+ minimatch.unescape = unescape;
1108
+ //# sourceMappingURL=index.js.map