diff options
Diffstat (limited to 'node_modules/ignore')
| -rw-r--r-- | node_modules/ignore/index.js | 24 | ||||
| -rw-r--r-- | node_modules/ignore/legacy.js | 40 | ||||
| -rw-r--r-- | node_modules/ignore/package.json | 7 |
3 files changed, 48 insertions, 23 deletions
diff --git a/node_modules/ignore/index.js b/node_modules/ignore/index.js index c5598064..9f0dbfeb 100644 --- a/node_modules/ignore/index.js +++ b/node_modules/ignore/index.js @@ -79,17 +79,26 @@ const REPLACERS = [ [ // (a\ ) -> (a ) // (a ) -> (a) + // (a ) -> (a) // (a \ ) -> (a ) - /\\?\s+$/, - match => match.indexOf('\\') === 0 - ? SPACE - : EMPTY + /((?:\\\\)*?)(\\?\s+)$/, + (_, m1, m2) => m1 + ( + m2.indexOf('\\') === 0 + ? SPACE + : EMPTY + ) ], // replace (\ ) with ' ' + // (\ ) -> ' ' + // (\\ ) -> '\\ ' + // (\\\ ) -> '\\ ' [ - /\\\s/g, - () => SPACE + /(\\+?)\s/g, + (_, m1) => { + const {length} = m1 + return m1.slice(0, length - length % 2) + SPACE + } ], // Escape metacharacters @@ -317,7 +326,8 @@ const makeRegex = (pattern, ignoreCase) => { if (!source) { source = REPLACERS.reduce( - (prev, current) => prev.replace(current[0], current[1].bind(pattern)), + (prev, [matcher, replacer]) => + prev.replace(matcher, replacer.bind(pattern)), pattern ) regexCache[pattern] = source diff --git a/node_modules/ignore/legacy.js b/node_modules/ignore/legacy.js index e9704718..de3f66ce 100644 --- a/node_modules/ignore/legacy.js +++ b/node_modules/ignore/legacy.js @@ -6,6 +6,12 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 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); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } +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."); } +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); } +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; } +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; } } +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // A simple implementation of make-array function makeArray(subject) { return Array.isArray(subject) ? subject : [subject]; @@ -82,13 +88,18 @@ var REPLACERS = [[ [ // (a\ ) -> (a ) // (a ) -> (a) +// (a ) -> (a) // (a \ ) -> (a ) -/\\?\s+$/, function (match) { - return match.indexOf('\\') === 0 ? SPACE : EMPTY; +/((?:\\\\)*?)(\\?\s+)$/, function (_, m1, m2) { + return m1 + (m2.indexOf('\\') === 0 ? SPACE : EMPTY); }], // replace (\ ) with ' ' -[/\\\s/g, function () { - return SPACE; +// (\ ) -> ' ' +// (\\ ) -> '\\ ' +// (\\\ ) -> '\\ ' +[/(\\+?)\s/g, function (_, m1) { + var length = m1.length; + return m1.slice(0, length - length % 2) + SPACE; }], // Escape metacharacters // which is written down by users but means special for regular expressions. @@ -277,8 +288,11 @@ var regexCache = Object.create(null); var makeRegex = function makeRegex(pattern, ignoreCase) { var source = regexCache[pattern]; if (!source) { - source = REPLACERS.reduce(function (prev, current) { - return prev.replace(current[0], current[1].bind(pattern)); + source = REPLACERS.reduce(function (prev, _ref) { + var _ref2 = _slicedToArray(_ref, 2), + matcher = _ref2[0], + replacer = _ref2[1]; + return prev.replace(matcher, replacer.bind(pattern)); }, pattern); regexCache[pattern] = source; } @@ -353,13 +367,13 @@ checkPath.convert = function (p) { }; var Ignore = /*#__PURE__*/function () { function Ignore() { - var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref$ignorecase = _ref.ignorecase, - ignorecase = _ref$ignorecase === void 0 ? true : _ref$ignorecase, - _ref$ignoreCase = _ref.ignoreCase, - ignoreCase = _ref$ignoreCase === void 0 ? ignorecase : _ref$ignoreCase, - _ref$allowRelativePat = _ref.allowRelativePaths, - allowRelativePaths = _ref$allowRelativePat === void 0 ? false : _ref$allowRelativePat; + var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref3$ignorecase = _ref3.ignorecase, + ignorecase = _ref3$ignorecase === void 0 ? true : _ref3$ignorecase, + _ref3$ignoreCase = _ref3.ignoreCase, + ignoreCase = _ref3$ignoreCase === void 0 ? ignorecase : _ref3$ignoreCase, + _ref3$allowRelativePa = _ref3.allowRelativePaths, + allowRelativePaths = _ref3$allowRelativePa === void 0 ? false : _ref3$allowRelativePa; _classCallCheck(this, Ignore); define(this, KEY_IGNORE, true); this._rules = []; diff --git a/node_modules/ignore/package.json b/node_modules/ignore/package.json index edc78d3c..b7f684e9 100644 --- a/node_modules/ignore/package.json +++ b/node_modules/ignore/package.json @@ -1,6 +1,6 @@ { "name": "ignore", - "version": "5.3.1", + "version": "5.3.2", "description": "Ignore is a manager and filter for .gitignore rules, the one used by eslint, gitbook and many others.", "files": [ "legacy.js", @@ -17,6 +17,7 @@ "tap": "tap --reporter classic", "test:git": "npm run tap test/git-check-ignore.js", "test:ignore": "npm run tap test/ignore.js", + "test:ignore:only": "IGNORE_ONLY_IGNORES=1 npm run tap test/ignore.js", "test:others": "npm run tap test/others.js", "test:cases": "npm run tap test/*.js -- --coverage", "test:no-coverage": "npm run tap test/*.js -- --no-check-coverage", @@ -61,10 +62,10 @@ "eslint-plugin-import": "^2.28.0", "mkdirp": "^3.0.1", "pre-suf": "^1.1.1", - "rimraf": "^5.0.1", + "rimraf": "^6.0.1", "spawn-sync": "^2.0.0", "tap": "^16.3.9", - "tmp": "0.2.1", + "tmp": "0.2.3", "typescript": "^5.1.6" }, "engines": { |
