phantom-pr 0.2.2 → 0.2.4

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 (242) hide show
  1. package/dist/cli.js +7 -0
  2. package/dist/cli.js.map +1 -1
  3. package/node_modules/ignore/LICENSE-MIT +21 -0
  4. package/node_modules/ignore/README.md +452 -0
  5. package/node_modules/ignore/index.d.ts +81 -0
  6. package/node_modules/ignore/index.js +784 -0
  7. package/node_modules/ignore/legacy.js +681 -0
  8. package/node_modules/ignore/package.json +87 -0
  9. package/node_modules/yaml/LICENSE +13 -0
  10. package/node_modules/yaml/README.md +172 -0
  11. package/node_modules/yaml/bin.mjs +11 -0
  12. package/node_modules/yaml/browser/dist/compose/compose-collection.js +88 -0
  13. package/node_modules/yaml/browser/dist/compose/compose-doc.js +43 -0
  14. package/node_modules/yaml/browser/dist/compose/compose-node.js +102 -0
  15. package/node_modules/yaml/browser/dist/compose/compose-scalar.js +86 -0
  16. package/node_modules/yaml/browser/dist/compose/composer.js +217 -0
  17. package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +115 -0
  18. package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +198 -0
  19. package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +49 -0
  20. package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
  21. package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +207 -0
  22. package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +223 -0
  23. package/node_modules/yaml/browser/dist/compose/resolve-props.js +146 -0
  24. package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
  25. package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +26 -0
  26. package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
  27. package/node_modules/yaml/browser/dist/compose/util-map-includes.js +13 -0
  28. package/node_modules/yaml/browser/dist/doc/Document.js +335 -0
  29. package/node_modules/yaml/browser/dist/doc/anchors.js +71 -0
  30. package/node_modules/yaml/browser/dist/doc/applyReviver.js +55 -0
  31. package/node_modules/yaml/browser/dist/doc/createNode.js +88 -0
  32. package/node_modules/yaml/browser/dist/doc/directives.js +176 -0
  33. package/node_modules/yaml/browser/dist/errors.js +57 -0
  34. package/node_modules/yaml/browser/dist/index.js +17 -0
  35. package/node_modules/yaml/browser/dist/log.js +11 -0
  36. package/node_modules/yaml/browser/dist/nodes/Alias.js +114 -0
  37. package/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
  38. package/node_modules/yaml/browser/dist/nodes/Node.js +38 -0
  39. package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
  40. package/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
  41. package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +144 -0
  42. package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +113 -0
  43. package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +63 -0
  44. package/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
  45. package/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
  46. package/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
  47. package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
  48. package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
  49. package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
  50. package/node_modules/yaml/browser/dist/parse/lexer.js +717 -0
  51. package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
  52. package/node_modules/yaml/browser/dist/parse/parser.js +967 -0
  53. package/node_modules/yaml/browser/dist/public-api.js +102 -0
  54. package/node_modules/yaml/browser/dist/schema/Schema.js +37 -0
  55. package/node_modules/yaml/browser/dist/schema/common/map.js +17 -0
  56. package/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
  57. package/node_modules/yaml/browser/dist/schema/common/seq.js +17 -0
  58. package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
  59. package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
  60. package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
  61. package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
  62. package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
  63. package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
  64. package/node_modules/yaml/browser/dist/schema/tags.js +96 -0
  65. package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +58 -0
  66. package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
  67. package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
  68. package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
  69. package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +64 -0
  70. package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +74 -0
  71. package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +78 -0
  72. package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +39 -0
  73. package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +93 -0
  74. package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
  75. package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +146 -0
  76. package/node_modules/yaml/browser/dist/stringify/stringify.js +128 -0
  77. package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +143 -0
  78. package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
  79. package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
  80. package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +24 -0
  81. package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
  82. package/node_modules/yaml/browser/dist/stringify/stringifyString.js +336 -0
  83. package/node_modules/yaml/browser/dist/util.js +11 -0
  84. package/node_modules/yaml/browser/dist/visit.js +233 -0
  85. package/node_modules/yaml/browser/index.js +5 -0
  86. package/node_modules/yaml/browser/package.json +3 -0
  87. package/node_modules/yaml/dist/cli.d.ts +8 -0
  88. package/node_modules/yaml/dist/cli.mjs +201 -0
  89. package/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
  90. package/node_modules/yaml/dist/compose/compose-collection.js +90 -0
  91. package/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
  92. package/node_modules/yaml/dist/compose/compose-doc.js +45 -0
  93. package/node_modules/yaml/dist/compose/compose-node.d.ts +29 -0
  94. package/node_modules/yaml/dist/compose/compose-node.js +105 -0
  95. package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
  96. package/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
  97. package/node_modules/yaml/dist/compose/composer.d.ts +63 -0
  98. package/node_modules/yaml/dist/compose/composer.js +222 -0
  99. package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
  100. package/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
  101. package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
  102. package/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
  103. package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
  104. package/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
  105. package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
  106. package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
  107. package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
  108. package/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
  109. package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
  110. package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +225 -0
  111. package/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
  112. package/node_modules/yaml/dist/compose/resolve-props.js +148 -0
  113. package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
  114. package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
  115. package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
  116. package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
  117. package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
  118. package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
  119. package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
  120. package/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
  121. package/node_modules/yaml/dist/doc/Document.d.ts +141 -0
  122. package/node_modules/yaml/dist/doc/Document.js +337 -0
  123. package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
  124. package/node_modules/yaml/dist/doc/anchors.js +76 -0
  125. package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
  126. package/node_modules/yaml/dist/doc/applyReviver.js +57 -0
  127. package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
  128. package/node_modules/yaml/dist/doc/createNode.js +90 -0
  129. package/node_modules/yaml/dist/doc/directives.d.ts +49 -0
  130. package/node_modules/yaml/dist/doc/directives.js +178 -0
  131. package/node_modules/yaml/dist/errors.d.ts +21 -0
  132. package/node_modules/yaml/dist/errors.js +62 -0
  133. package/node_modules/yaml/dist/index.d.ts +25 -0
  134. package/node_modules/yaml/dist/index.js +50 -0
  135. package/node_modules/yaml/dist/log.d.ts +3 -0
  136. package/node_modules/yaml/dist/log.js +19 -0
  137. package/node_modules/yaml/dist/nodes/Alias.d.ts +29 -0
  138. package/node_modules/yaml/dist/nodes/Alias.js +116 -0
  139. package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
  140. package/node_modules/yaml/dist/nodes/Collection.js +151 -0
  141. package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
  142. package/node_modules/yaml/dist/nodes/Node.js +40 -0
  143. package/node_modules/yaml/dist/nodes/Pair.d.ts +22 -0
  144. package/node_modules/yaml/dist/nodes/Pair.js +39 -0
  145. package/node_modules/yaml/dist/nodes/Scalar.d.ts +43 -0
  146. package/node_modules/yaml/dist/nodes/Scalar.js +27 -0
  147. package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
  148. package/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
  149. package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
  150. package/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
  151. package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
  152. package/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
  153. package/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
  154. package/node_modules/yaml/dist/nodes/identity.js +53 -0
  155. package/node_modules/yaml/dist/nodes/toJS.d.ts +29 -0
  156. package/node_modules/yaml/dist/nodes/toJS.js +39 -0
  157. package/node_modules/yaml/dist/options.d.ts +344 -0
  158. package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
  159. package/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
  160. package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
  161. package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
  162. package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
  163. package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
  164. package/node_modules/yaml/dist/parse/cst.d.ts +109 -0
  165. package/node_modules/yaml/dist/parse/cst.js +112 -0
  166. package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
  167. package/node_modules/yaml/dist/parse/lexer.js +719 -0
  168. package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
  169. package/node_modules/yaml/dist/parse/line-counter.js +41 -0
  170. package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
  171. package/node_modules/yaml/dist/parse/parser.js +972 -0
  172. package/node_modules/yaml/dist/public-api.d.ts +44 -0
  173. package/node_modules/yaml/dist/public-api.js +107 -0
  174. package/node_modules/yaml/dist/schema/Schema.d.ts +17 -0
  175. package/node_modules/yaml/dist/schema/Schema.js +39 -0
  176. package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
  177. package/node_modules/yaml/dist/schema/common/map.js +19 -0
  178. package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
  179. package/node_modules/yaml/dist/schema/common/null.js +17 -0
  180. package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
  181. package/node_modules/yaml/dist/schema/common/seq.js +19 -0
  182. package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
  183. package/node_modules/yaml/dist/schema/common/string.js +16 -0
  184. package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
  185. package/node_modules/yaml/dist/schema/core/bool.js +21 -0
  186. package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
  187. package/node_modules/yaml/dist/schema/core/float.js +47 -0
  188. package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
  189. package/node_modules/yaml/dist/schema/core/int.js +42 -0
  190. package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
  191. package/node_modules/yaml/dist/schema/core/schema.js +25 -0
  192. package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
  193. package/node_modules/yaml/dist/schema/json/schema.js +64 -0
  194. package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
  195. package/node_modules/yaml/dist/schema/tags.d.ts +48 -0
  196. package/node_modules/yaml/dist/schema/tags.js +99 -0
  197. package/node_modules/yaml/dist/schema/types.d.ts +92 -0
  198. package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
  199. package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
  200. package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
  201. package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
  202. package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
  203. package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
  204. package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
  205. package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
  206. package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
  207. package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +68 -0
  208. package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +22 -0
  209. package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
  210. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
  211. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
  212. package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
  213. package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
  214. package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
  215. package/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
  216. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
  217. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
  218. package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
  219. package/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
  220. package/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
  221. package/node_modules/yaml/dist/stringify/stringify.js +131 -0
  222. package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
  223. package/node_modules/yaml/dist/stringify/stringifyCollection.js +145 -0
  224. package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
  225. package/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
  226. package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
  227. package/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
  228. package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
  229. package/node_modules/yaml/dist/stringify/stringifyNumber.js +26 -0
  230. package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
  231. package/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
  232. package/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
  233. package/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
  234. package/node_modules/yaml/dist/test-events.d.ts +4 -0
  235. package/node_modules/yaml/dist/test-events.js +134 -0
  236. package/node_modules/yaml/dist/util.d.ts +16 -0
  237. package/node_modules/yaml/dist/util.js +28 -0
  238. package/node_modules/yaml/dist/visit.d.ts +102 -0
  239. package/node_modules/yaml/dist/visit.js +236 -0
  240. package/node_modules/yaml/package.json +97 -0
  241. package/node_modules/yaml/util.js +2 -0
  242. package/package.json +5 -1
@@ -0,0 +1,681 @@
1
+ "use strict";
2
+
3
+ var _TRAILING_WILD_CARD_R;
4
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
12
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
16
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
17
+ // A simple implementation of make-array
18
+ function makeArray(subject) {
19
+ return Array.isArray(subject) ? subject : [subject];
20
+ }
21
+ var UNDEFINED = undefined;
22
+ var EMPTY = '';
23
+ var SPACE = ' ';
24
+ var ESCAPE = '\\';
25
+ var REGEX_TEST_BLANK_LINE = /^\s+$/;
26
+ var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
27
+ var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
28
+ var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
29
+ var REGEX_SPLITALL_CRLF = /\r?\n/g;
30
+
31
+ // Invalid:
32
+ // - /foo,
33
+ // - ./foo,
34
+ // - ../foo,
35
+ // - .
36
+ // - ..
37
+ // Valid:
38
+ // - .foo
39
+ var REGEX_TEST_INVALID_PATH = /^\.{0,2}\/|^\.{1,2}$/;
40
+ var REGEX_TEST_TRAILING_SLASH = /\/$/;
41
+ var SLASH = '/';
42
+
43
+ // Do not use ternary expression here, since "istanbul ignore next" is buggy
44
+ var TMP_KEY_IGNORE = 'node-ignore';
45
+ /* istanbul ignore else */
46
+ if (typeof Symbol !== 'undefined') {
47
+ TMP_KEY_IGNORE = Symbol["for"]('node-ignore');
48
+ }
49
+ var KEY_IGNORE = TMP_KEY_IGNORE;
50
+ var define = function define(object, key, value) {
51
+ Object.defineProperty(object, key, {
52
+ value: value
53
+ });
54
+ return value;
55
+ };
56
+ var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
57
+ var RETURN_FALSE = function RETURN_FALSE() {
58
+ return false;
59
+ };
60
+
61
+ // Sanitize the range of a regular expression
62
+ // The cases are complicated, see test cases for details
63
+ var sanitizeRange = function sanitizeRange(range) {
64
+ return range.replace(REGEX_REGEXP_RANGE, function (match, from, to) {
65
+ return from.charCodeAt(0) <= to.charCodeAt(0) ? match
66
+ // Invalid range (out of order) which is ok for gitignore rules but
67
+ // fatal for JavaScript regular expression, so eliminate it.
68
+ : EMPTY;
69
+ });
70
+ };
71
+
72
+ // See fixtures #59
73
+ var cleanRangeBackSlash = function cleanRangeBackSlash(slashes) {
74
+ var length = slashes.length;
75
+ return slashes.slice(0, length - length % 2);
76
+ };
77
+
78
+ // > If the pattern ends with a slash,
79
+ // > it is removed for the purpose of the following description,
80
+ // > but it would only find a match with a directory.
81
+ // > In other words, foo/ will match a directory foo and paths underneath it,
82
+ // > but will not match a regular file or a symbolic link foo
83
+ // > (this is consistent with the way how pathspec works in general in Git).
84
+ // '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'
85
+ // -> ignore-rules will not deal with it, because it costs extra `fs.stat` call
86
+ // you could use option `mark: true` with `glob`
87
+
88
+ // '`foo/`' should not continue with the '`..`'
89
+ var REPLACERS = [[
90
+ // Remove BOM
91
+ // TODO:
92
+ // Other similar zero-width characters?
93
+ /^\uFEFF/, function () {
94
+ return EMPTY;
95
+ }],
96
+ // > Trailing spaces are ignored unless they are quoted with backslash ("\")
97
+ [
98
+ // (a\ ) -> (a )
99
+ // (a ) -> (a)
100
+ // (a ) -> (a)
101
+ // (a \ ) -> (a )
102
+ /((?:\\\\)*?)(\\?\s+)$/, function (_, m1, m2) {
103
+ return m1 + (m2.indexOf('\\') === 0 ? SPACE : EMPTY);
104
+ }],
105
+ // Replace (\ ) with ' '
106
+ // (\ ) -> ' '
107
+ // (\\ ) -> '\\ '
108
+ // (\\\ ) -> '\\ '
109
+ [/(\\+?)\s/g, function (_, m1) {
110
+ var length = m1.length;
111
+ return m1.slice(0, length - length % 2) + SPACE;
112
+ }],
113
+ // Escape metacharacters
114
+ // which is written down by users but means special for regular expressions.
115
+
116
+ // > There are 12 characters with special meanings:
117
+ // > - the backslash \,
118
+ // > - the caret ^,
119
+ // > - the dollar sign $,
120
+ // > - the period or dot .,
121
+ // > - the vertical bar or pipe symbol |,
122
+ // > - the question mark ?,
123
+ // > - the asterisk or star *,
124
+ // > - the plus sign +,
125
+ // > - the opening parenthesis (,
126
+ // > - the closing parenthesis ),
127
+ // > - and the opening square bracket [,
128
+ // > - the opening curly brace {,
129
+ // > These special characters are often called "metacharacters".
130
+ [/[\\$.|*+(){^]/g, function (match) {
131
+ return "\\".concat(match);
132
+ }], [
133
+ // > a question mark (?) matches a single character
134
+ /(?!\\)\?/g, function () {
135
+ return '[^/]';
136
+ }],
137
+ // leading slash
138
+ [
139
+ // > A leading slash matches the beginning of the pathname.
140
+ // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
141
+ // A leading slash matches the beginning of the pathname
142
+ /^\//, function () {
143
+ return '^';
144
+ }],
145
+ // replace special metacharacter slash after the leading slash
146
+ [/\//g, function () {
147
+ return '\\/';
148
+ }], [
149
+ // > A leading "**" followed by a slash means match in all directories.
150
+ // > For example, "**/foo" matches file or directory "foo" anywhere,
151
+ // > the same as pattern "foo".
152
+ // > "**/foo/bar" matches file or directory "bar" anywhere that is directly
153
+ // > under directory "foo".
154
+ // Notice that the '*'s have been replaced as '\\*'
155
+ /^\^*\\\*\\\*\\\//,
156
+ // '**/foo' <-> 'foo'
157
+ function () {
158
+ return '^(?:.*\\/)?';
159
+ }],
160
+ // starting
161
+ [
162
+ // there will be no leading '/'
163
+ // (which has been replaced by section "leading slash")
164
+ // If starts with '**', adding a '^' to the regular expression also works
165
+ /^(?=[^^])/, function startingReplacer() {
166
+ // If has a slash `/` at the beginning or middle
167
+ return !/\/(?!$)/.test(this)
168
+ // > Prior to 2.22.1
169
+ // > If the pattern does not contain a slash /,
170
+ // > Git treats it as a shell glob pattern
171
+ // Actually, if there is only a trailing slash,
172
+ // git also treats it as a shell glob pattern
173
+
174
+ // After 2.22.1 (compatible but clearer)
175
+ // > If there is a separator at the beginning or middle (or both)
176
+ // > of the pattern, then the pattern is relative to the directory
177
+ // > level of the particular .gitignore file itself.
178
+ // > Otherwise the pattern may also match at any level below
179
+ // > the .gitignore level.
180
+ ? '(?:^|\\/)'
181
+
182
+ // > Otherwise, Git treats the pattern as a shell glob suitable for
183
+ // > consumption by fnmatch(3)
184
+ : '^';
185
+ }],
186
+ // two globstars
187
+ [
188
+ // Use lookahead assertions so that we could match more than one `'/**'`
189
+ /\\\/\\\*\\\*(?=\\\/|$)/g,
190
+ // Zero, one or several directories
191
+ // should not use '*', or it will be replaced by the next replacer
192
+
193
+ // Check if it is not the last `'/**'`
194
+ function (_, index, str) {
195
+ return index + 6 < str.length
196
+
197
+ // case: /**/
198
+ // > A slash followed by two consecutive asterisks then a slash matches
199
+ // > zero or more directories.
200
+ // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.
201
+ // '/**/'
202
+ ? '(?:\\/[^\\/]+)*'
203
+
204
+ // case: /**
205
+ // > A trailing `"/**"` matches everything inside.
206
+
207
+ // #21: everything inside but it should not include the current folder
208
+ : '\\/.+';
209
+ }],
210
+ // normal intermediate wildcards
211
+ [
212
+ // Never replace escaped '*'
213
+ // ignore rule '\*' will match the path '*'
214
+
215
+ // 'abc.*/' -> go
216
+ // 'abc.*' -> skip this rule,
217
+ // coz trailing single wildcard will be handed by [trailing wildcard]
218
+ /(^|[^\\]+)(\\\*)+(?=.+)/g,
219
+ // '*.js' matches '.js'
220
+ // '*.js' doesn't match 'abc'
221
+ function (_, p1, p2) {
222
+ // 1.
223
+ // > An asterisk "*" matches anything except a slash.
224
+ // 2.
225
+ // > Other consecutive asterisks are considered regular asterisks
226
+ // > and will match according to the previous rules.
227
+ var unescaped = p2.replace(/\\\*/g, '[^\\/]*');
228
+ return p1 + unescaped;
229
+ }], [
230
+ // unescape, revert step 3 except for back slash
231
+ // For example, if a user escape a '\\*',
232
+ // after step 3, the result will be '\\\\\\*'
233
+ /\\\\\\(?=[$.|*+(){^])/g, function () {
234
+ return ESCAPE;
235
+ }], [
236
+ // '\\\\' -> '\\'
237
+ /\\\\/g, function () {
238
+ return ESCAPE;
239
+ }], [
240
+ // > The range notation, e.g. [a-zA-Z],
241
+ // > can be used to match one of the characters in a range.
242
+
243
+ // `\` is escaped by step 3
244
+ /(\\)?\[([^\]/]*?)(\\*)($|\])/g, function (match, leadEscape, range, endEscape, close) {
245
+ return leadEscape === ESCAPE
246
+ // '\\[bar]' -> '\\\\[bar\\]'
247
+ ? "\\[".concat(range).concat(cleanRangeBackSlash(endEscape)).concat(close) : close === ']' ? endEscape.length % 2 === 0
248
+ // A normal case, and it is a range notation
249
+ // '[bar]'
250
+ // '[bar\\\\]'
251
+ ? "[".concat(sanitizeRange(range)).concat(endEscape, "]") // Invalid range notaton
252
+ // '[bar\\]' -> '[bar\\\\]'
253
+ : '[]' : '[]';
254
+ }],
255
+ // ending
256
+ [
257
+ // 'js' will not match 'js.'
258
+ // 'ab' will not match 'abc'
259
+ /(?:[^*])$/,
260
+ // WTF!
261
+ // https://git-scm.com/docs/gitignore
262
+ // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
263
+ // which re-fixes #24, #38
264
+
265
+ // > If there is a separator at the end of the pattern then the pattern
266
+ // > will only match directories, otherwise the pattern can match both
267
+ // > files and directories.
268
+
269
+ // 'js*' will not match 'a.js'
270
+ // 'js/' will not match 'a.js'
271
+ // 'js' will match 'a.js' and 'a.js/'
272
+ function (match) {
273
+ return /\/$/.test(match)
274
+ // foo/ will not match 'foo'
275
+ ? "".concat(match, "$") // foo matches 'foo' and 'foo/'
276
+ : "".concat(match, "(?=$|\\/$)");
277
+ }]];
278
+ var REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\\\*$/;
279
+ var MODE_IGNORE = 'regex';
280
+ var MODE_CHECK_IGNORE = 'checkRegex';
281
+ var UNDERSCORE = '_';
282
+ var TRAILING_WILD_CARD_REPLACERS = (_TRAILING_WILD_CARD_R = {}, _defineProperty(_TRAILING_WILD_CARD_R, MODE_IGNORE, function (_, p1) {
283
+ var prefix = p1
284
+ // '\^':
285
+ // '/*' does not match EMPTY
286
+ // '/*' does not match everything
287
+
288
+ // '\\\/':
289
+ // 'abc/*' does not match 'abc/'
290
+ ? "".concat(p1, "[^/]+") // 'a*' matches 'a'
291
+ // 'a*' matches 'aa'
292
+ : '[^/]*';
293
+ return "".concat(prefix, "(?=$|\\/$)");
294
+ }), _defineProperty(_TRAILING_WILD_CARD_R, MODE_CHECK_IGNORE, function (_, p1) {
295
+ // When doing `git check-ignore`
296
+ var prefix = p1
297
+ // '\\\/':
298
+ // 'abc/*' DOES match 'abc/' !
299
+ ? "".concat(p1, "[^/]*") // 'a*' matches 'a'
300
+ // 'a*' matches 'aa'
301
+ : '[^/]*';
302
+ return "".concat(prefix, "(?=$|\\/$)");
303
+ }), _TRAILING_WILD_CARD_R);
304
+
305
+ // @param {pattern}
306
+ var makeRegexPrefix = function makeRegexPrefix(pattern) {
307
+ return REPLACERS.reduce(function (prev, _ref) {
308
+ var _ref2 = _slicedToArray(_ref, 2),
309
+ matcher = _ref2[0],
310
+ replacer = _ref2[1];
311
+ return prev.replace(matcher, replacer.bind(pattern));
312
+ }, pattern);
313
+ };
314
+ var isString = function isString(subject) {
315
+ return typeof subject === 'string';
316
+ };
317
+
318
+ // > A blank line matches no files, so it can serve as a separator for readability.
319
+ var checkPattern = function checkPattern(pattern) {
320
+ return pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern)
321
+
322
+ // > A line starting with # serves as a comment.
323
+ && pattern.indexOf('#') !== 0;
324
+ };
325
+ var splitPattern = function splitPattern(pattern) {
326
+ return pattern.split(REGEX_SPLITALL_CRLF).filter(Boolean);
327
+ };
328
+ var IgnoreRule = /*#__PURE__*/function () {
329
+ function IgnoreRule(pattern, mark, body, ignoreCase, negative, prefix) {
330
+ _classCallCheck(this, IgnoreRule);
331
+ this.pattern = pattern;
332
+ this.mark = mark;
333
+ this.negative = negative;
334
+ define(this, 'body', body);
335
+ define(this, 'ignoreCase', ignoreCase);
336
+ define(this, 'regexPrefix', prefix);
337
+ }
338
+ _createClass(IgnoreRule, [{
339
+ key: "regex",
340
+ get: function get() {
341
+ var key = UNDERSCORE + MODE_IGNORE;
342
+ if (this[key]) {
343
+ return this[key];
344
+ }
345
+ return this._make(MODE_IGNORE, key);
346
+ }
347
+ }, {
348
+ key: "checkRegex",
349
+ get: function get() {
350
+ var key = UNDERSCORE + MODE_CHECK_IGNORE;
351
+ if (this[key]) {
352
+ return this[key];
353
+ }
354
+ return this._make(MODE_CHECK_IGNORE, key);
355
+ }
356
+ }, {
357
+ key: "_make",
358
+ value: function _make(mode, key) {
359
+ var str = this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD,
360
+ // It does not need to bind pattern
361
+ TRAILING_WILD_CARD_REPLACERS[mode]);
362
+ var regex = this.ignoreCase ? new RegExp(str, 'i') : new RegExp(str);
363
+ return define(this, key, regex);
364
+ }
365
+ }]);
366
+ return IgnoreRule;
367
+ }();
368
+ var createRule = function createRule(_ref3, ignoreCase) {
369
+ var pattern = _ref3.pattern,
370
+ mark = _ref3.mark;
371
+ var negative = false;
372
+ var body = pattern;
373
+
374
+ // > An optional prefix "!" which negates the pattern;
375
+ if (body.indexOf('!') === 0) {
376
+ negative = true;
377
+ body = body.substr(1);
378
+ }
379
+ body = body
380
+ // > Put a backslash ("\") in front of the first "!" for patterns that
381
+ // > begin with a literal "!", for example, `"\!important!.txt"`.
382
+ .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!')
383
+ // > Put a backslash ("\") in front of the first hash for patterns that
384
+ // > begin with a hash.
385
+ .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#');
386
+ var regexPrefix = makeRegexPrefix(body);
387
+ return new IgnoreRule(pattern, mark, body, ignoreCase, negative, regexPrefix);
388
+ };
389
+ var RuleManager = /*#__PURE__*/function () {
390
+ function RuleManager(ignoreCase) {
391
+ _classCallCheck(this, RuleManager);
392
+ this._ignoreCase = ignoreCase;
393
+ this._rules = [];
394
+ }
395
+ _createClass(RuleManager, [{
396
+ key: "_add",
397
+ value: function _add(pattern) {
398
+ // #32
399
+ if (pattern && pattern[KEY_IGNORE]) {
400
+ this._rules = this._rules.concat(pattern._rules._rules);
401
+ this._added = true;
402
+ return;
403
+ }
404
+ if (isString(pattern)) {
405
+ pattern = {
406
+ pattern: pattern
407
+ };
408
+ }
409
+ if (checkPattern(pattern.pattern)) {
410
+ var rule = createRule(pattern, this._ignoreCase);
411
+ this._added = true;
412
+ this._rules.push(rule);
413
+ }
414
+ }
415
+
416
+ // @param {Array<string> | string | Ignore} pattern
417
+ }, {
418
+ key: "add",
419
+ value: function add(pattern) {
420
+ this._added = false;
421
+ makeArray(isString(pattern) ? splitPattern(pattern) : pattern).forEach(this._add, this);
422
+ return this._added;
423
+ }
424
+
425
+ // Test one single path without recursively checking parent directories
426
+ //
427
+ // - checkUnignored `boolean` whether should check if the path is unignored,
428
+ // setting `checkUnignored` to `false` could reduce additional
429
+ // path matching.
430
+ // - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
431
+
432
+ // @returns {TestResult} true if a file is ignored
433
+ }, {
434
+ key: "test",
435
+ value: function test(path, checkUnignored, mode) {
436
+ var ignored = false;
437
+ var unignored = false;
438
+ var matchedRule;
439
+ this._rules.forEach(function (rule) {
440
+ var negative = rule.negative;
441
+
442
+ // | ignored : unignored
443
+ // -------- | ---------------------------------------
444
+ // negative | 0:0 | 0:1 | 1:0 | 1:1
445
+ // -------- | ------- | ------- | ------- | --------
446
+ // 0 | TEST | TEST | SKIP | X
447
+ // 1 | TESTIF | SKIP | TEST | X
448
+
449
+ // - SKIP: always skip
450
+ // - TEST: always test
451
+ // - TESTIF: only test if checkUnignored
452
+ // - X: that never happen
453
+ if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
454
+ return;
455
+ }
456
+ var matched = rule[mode].test(path);
457
+ if (!matched) {
458
+ return;
459
+ }
460
+ ignored = !negative;
461
+ unignored = negative;
462
+ matchedRule = negative ? UNDEFINED : rule;
463
+ });
464
+ var ret = {
465
+ ignored: ignored,
466
+ unignored: unignored
467
+ };
468
+ if (matchedRule) {
469
+ ret.rule = matchedRule;
470
+ }
471
+ return ret;
472
+ }
473
+ }]);
474
+ return RuleManager;
475
+ }();
476
+ var throwError = function throwError(message, Ctor) {
477
+ throw new Ctor(message);
478
+ };
479
+ var checkPath = function checkPath(path, originalPath, doThrow) {
480
+ if (!isString(path)) {
481
+ return doThrow("path must be a string, but got `".concat(originalPath, "`"), TypeError);
482
+ }
483
+
484
+ // We don't know if we should ignore EMPTY, so throw
485
+ if (!path) {
486
+ return doThrow("path must not be empty", TypeError);
487
+ }
488
+
489
+ // Check if it is a relative path
490
+ if (checkPath.isNotRelative(path)) {
491
+ var r = '`path.relative()`d';
492
+ return doThrow("path should be a ".concat(r, " string, but got \"").concat(originalPath, "\""), RangeError);
493
+ }
494
+ return true;
495
+ };
496
+ var isNotRelative = function isNotRelative(path) {
497
+ return REGEX_TEST_INVALID_PATH.test(path);
498
+ };
499
+ checkPath.isNotRelative = isNotRelative;
500
+
501
+ // On windows, the following function will be replaced
502
+ /* istanbul ignore next */
503
+ checkPath.convert = function (p) {
504
+ return p;
505
+ };
506
+ var Ignore = /*#__PURE__*/function () {
507
+ function Ignore() {
508
+ var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
509
+ _ref4$ignorecase = _ref4.ignorecase,
510
+ ignorecase = _ref4$ignorecase === void 0 ? true : _ref4$ignorecase,
511
+ _ref4$ignoreCase = _ref4.ignoreCase,
512
+ ignoreCase = _ref4$ignoreCase === void 0 ? ignorecase : _ref4$ignoreCase,
513
+ _ref4$allowRelativePa = _ref4.allowRelativePaths,
514
+ allowRelativePaths = _ref4$allowRelativePa === void 0 ? false : _ref4$allowRelativePa;
515
+ _classCallCheck(this, Ignore);
516
+ define(this, KEY_IGNORE, true);
517
+ this._rules = new RuleManager(ignoreCase);
518
+ this._strictPathCheck = !allowRelativePaths;
519
+ this._initCache();
520
+ }
521
+ _createClass(Ignore, [{
522
+ key: "_initCache",
523
+ value: function _initCache() {
524
+ // A cache for the result of `.ignores()`
525
+ this._ignoreCache = Object.create(null);
526
+
527
+ // A cache for the result of `.test()`
528
+ this._testCache = Object.create(null);
529
+ }
530
+ }, {
531
+ key: "add",
532
+ value: function add(pattern) {
533
+ if (this._rules.add(pattern)) {
534
+ // Some rules have just added to the ignore,
535
+ // making the behavior changed,
536
+ // so we need to re-initialize the result cache
537
+ this._initCache();
538
+ }
539
+ return this;
540
+ }
541
+
542
+ // legacy
543
+ }, {
544
+ key: "addPattern",
545
+ value: function addPattern(pattern) {
546
+ return this.add(pattern);
547
+ }
548
+
549
+ // @returns {TestResult}
550
+ }, {
551
+ key: "_test",
552
+ value: function _test(originalPath, cache, checkUnignored, slices) {
553
+ var path = originalPath
554
+ // Supports nullable path
555
+ && checkPath.convert(originalPath);
556
+ checkPath(path, originalPath, this._strictPathCheck ? throwError : RETURN_FALSE);
557
+ return this._t(path, cache, checkUnignored, slices);
558
+ }
559
+ }, {
560
+ key: "checkIgnore",
561
+ value: function checkIgnore(path) {
562
+ // If the path doest not end with a slash, `.ignores()` is much equivalent
563
+ // to `git check-ignore`
564
+ if (!REGEX_TEST_TRAILING_SLASH.test(path)) {
565
+ return this.test(path);
566
+ }
567
+ var slices = path.split(SLASH).filter(Boolean);
568
+ slices.pop();
569
+ if (slices.length) {
570
+ var parent = this._t(slices.join(SLASH) + SLASH, this._testCache, true, slices);
571
+ if (parent.ignored) {
572
+ return parent;
573
+ }
574
+ }
575
+ return this._rules.test(path, false, MODE_CHECK_IGNORE);
576
+ }
577
+ }, {
578
+ key: "_t",
579
+ value: function _t(
580
+ // The path to be tested
581
+ path,
582
+ // The cache for the result of a certain checking
583
+ cache,
584
+ // Whether should check if the path is unignored
585
+ checkUnignored,
586
+ // The path slices
587
+ slices) {
588
+ if (path in cache) {
589
+ return cache[path];
590
+ }
591
+ if (!slices) {
592
+ // path/to/a.js
593
+ // ['path', 'to', 'a.js']
594
+ slices = path.split(SLASH).filter(Boolean);
595
+ }
596
+ slices.pop();
597
+
598
+ // If the path has no parent directory, just test it
599
+ if (!slices.length) {
600
+ return cache[path] = this._rules.test(path, checkUnignored, MODE_IGNORE);
601
+ }
602
+ var parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices);
603
+
604
+ // If the path contains a parent directory, check the parent first
605
+ return cache[path] = parent.ignored
606
+ // > It is not possible to re-include a file if a parent directory of
607
+ // > that file is excluded.
608
+ ? parent : this._rules.test(path, checkUnignored, MODE_IGNORE);
609
+ }
610
+ }, {
611
+ key: "ignores",
612
+ value: function ignores(path) {
613
+ return this._test(path, this._ignoreCache, false).ignored;
614
+ }
615
+ }, {
616
+ key: "createFilter",
617
+ value: function createFilter() {
618
+ var _this = this;
619
+ return function (path) {
620
+ return !_this.ignores(path);
621
+ };
622
+ }
623
+ }, {
624
+ key: "filter",
625
+ value: function filter(paths) {
626
+ return makeArray(paths).filter(this.createFilter());
627
+ }
628
+
629
+ // @returns {TestResult}
630
+ }, {
631
+ key: "test",
632
+ value: function test(path) {
633
+ return this._test(path, this._testCache, true);
634
+ }
635
+ }]);
636
+ return Ignore;
637
+ }();
638
+ var factory = function factory(options) {
639
+ return new Ignore(options);
640
+ };
641
+ var isPathValid = function isPathValid(path) {
642
+ return checkPath(path && checkPath.convert(path), path, RETURN_FALSE);
643
+ };
644
+
645
+ /* istanbul ignore next */
646
+ var setupWindows = function setupWindows() {
647
+ /* eslint no-control-regex: "off" */
648
+ var makePosix = function makePosix(str) {
649
+ return /^\\\\\?\\/.test(str) || /[\0-\x1F"<>\|]+/.test(str) ? str : str.replace(/\\/g, '/');
650
+ };
651
+ checkPath.convert = makePosix;
652
+
653
+ // 'C:\\foo' <- 'C:\\foo' has been converted to 'C:/'
654
+ // 'd:\\foo'
655
+ var REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
656
+ checkPath.isNotRelative = function (path) {
657
+ return REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
658
+ };
659
+ };
660
+
661
+ // Windows
662
+ // --------------------------------------------------------------
663
+ /* istanbul ignore next */
664
+ if (
665
+ // Detect `process` so that it can run in browsers.
666
+ typeof process !== 'undefined' && process.platform === 'win32') {
667
+ setupWindows();
668
+ }
669
+
670
+ // COMMONJS_EXPORTS ////////////////////////////////////////////////////////////
671
+
672
+ module.exports = factory;
673
+
674
+ // Although it is an anti-pattern,
675
+ // it is still widely misused by a lot of libraries in github
676
+ // Ref: https://github.com/search?q=ignore.default%28%29&type=code
677
+ factory["default"] = factory;
678
+ module.exports.isPathValid = isPathValid;
679
+
680
+ // For testing purposes
681
+ define(module.exports, Symbol["for"]('setupWindows'), setupWindows);