minimatch 4.2.0 → 4.2.2

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 (2) hide show
  1. package/minimatch.js +16 -12
  2. package/package.json +4 -1
package/minimatch.js CHANGED
@@ -472,8 +472,16 @@ class Minimatch {
472
472
  this.debug('%s\t%s %s %j', pattern, i, re, c)
473
473
 
474
474
  // skip over any that are escaped.
475
- if (escaping && reSpecials[c]) {
476
- re += '\\' + c
475
+ if (escaping) {
476
+ /* istanbul ignore next - completely not allowed, even escaped. */
477
+ if (c === '/') {
478
+ return false
479
+ }
480
+
481
+ if (reSpecials[c]) {
482
+ re += '\\'
483
+ }
484
+ re += c
477
485
  escaping = false
478
486
  continue
479
487
  }
@@ -481,7 +489,6 @@ class Minimatch {
481
489
  switch (c) {
482
490
  /* istanbul ignore next */
483
491
  case '/': {
484
- // completely not allowed, even escaped.
485
492
  // Should already be path-split by now.
486
493
  return false
487
494
  }
@@ -564,9 +571,8 @@ class Minimatch {
564
571
  continue
565
572
 
566
573
  case '|':
567
- if (inClass || !patternListStack.length || escaping) {
574
+ if (inClass || !patternListStack.length) {
568
575
  re += '\\|'
569
- escaping = false
570
576
  continue
571
577
  }
572
578
 
@@ -597,7 +603,6 @@ class Minimatch {
597
603
  // first in the list. -- POSIX.2 2.8.3.2
598
604
  if (i === classStart + 1 || !inClass) {
599
605
  re += '\\' + c
600
- escaping = false
601
606
  continue
602
607
  }
603
608
 
@@ -632,15 +637,12 @@ class Minimatch {
632
637
  // swallow any state char that wasn't consumed
633
638
  clearStateChar()
634
639
 
635
- if (escaping) {
636
- // no need
637
- escaping = false
638
- } else if (reSpecials[c]
639
- && !(c === '^' && inClass)) {
640
+ if (reSpecials[c] && !(c === '^' && inClass)) {
640
641
  re += '\\'
641
642
  }
642
643
 
643
644
  re += c
645
+ break
644
646
 
645
647
  } // switch
646
648
  } // for
@@ -670,6 +672,7 @@ class Minimatch {
670
672
  this.debug('setting tail', re, pl)
671
673
  // maybe some even number of \, then maybe 1 \, followed by a |
672
674
  tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_, $1, $2) => {
675
+ /* istanbul ignore else - should already be done */
673
676
  if (!$2) {
674
677
  // the | isn't already escaped, so escape it.
675
678
  $2 = '\\'
@@ -720,7 +723,8 @@ class Minimatch {
720
723
  // Handle nested stuff like *(*.js|!(*.json)), where open parens
721
724
  // mean that we should *not* include the ) in the bit that is considered
722
725
  // "after" the negated section.
723
- const openParensBefore = nlBefore.split('(').length - 1
726
+ const closeParensBefore = nlBefore.split(')').length
727
+ const openParensBefore = nlBefore.split('(').length - closeParensBefore
724
728
  let cleanAfter = nlAfter
725
729
  for (let i = 0; i < openParensBefore; i++) {
726
730
  cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
package/package.json CHANGED
@@ -2,7 +2,10 @@
2
2
  "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
3
3
  "name": "minimatch",
4
4
  "description": "a glob matcher in javascript",
5
- "version": "4.2.0",
5
+ "version": "4.2.2",
6
+ "publishConfig": {
7
+ "tag": "legacy-v4"
8
+ },
6
9
  "repository": {
7
10
  "type": "git",
8
11
  "url": "git://github.com/isaacs/minimatch.git"