Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

minimatch

Package Overview
Dependencies
Maintainers
1
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minimatch - npm Package Compare versions

Comparing version 4.2.2 to 4.2.3

74

minimatch.js

@@ -443,8 +443,20 @@ const minimatch = module.exports = (p, pattern, options = {}) => {

// . and .. never match anything that doesn't start with .,
// even when options.dot is set.
const patternStart = pattern.charAt(0) === '.' ? '' // anything
// not (start or / followed by . or .. followed by / or end)
: options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
: '(?!\\.)'
// even when options.dot is set. However, if the pattern
// starts with ., then traversal patterns can match.
let dotTravAllowed = pattern.charAt(0) === '.'
let dotFileAllowed = options.dot || dotTravAllowed
const patternStart = () =>
dotTravAllowed
? ''
: dotFileAllowed
? '(?!(?:^|\\/)\\.{1,2}(?:$|\\/))'
: '(?!\\.)'
const subPatternStart = (p) =>
p.charAt(0) === '.'
? ''
: options.dot
? '(?!(?:^|\\/)\\.{1,2}(?:$|\\/))'
: '(?!\\.)'
const clearStateChar = () => {

@@ -532,3 +544,3 @@ if (stateChar) {

case '(':
case '(': {
if (inClass) {

@@ -544,3 +556,3 @@ re += '('

patternListStack.push({
const plEntry = {
type: stateChar,

@@ -550,19 +562,30 @@ start: i - 1,

open: plTypes[stateChar].open,
close: plTypes[stateChar].close
})
// negation is (?:(?!js)[^/]*)
re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
close: plTypes[stateChar].close,
}
this.debug(this.pattern, '\t', plEntry)
patternListStack.push(plEntry)
// negation is (?:(?!(?:js)(?:<rest>))[^/]*)
re += plEntry.open
// next entry starts with a dot maybe?
if (plEntry.start === 0 && plEntry.type !== '!') {
dotTravAllowed = true
re += subPatternStart(pattern.slice(i + 1))
}
this.debug('plType %j %j', stateChar, re)
stateChar = false
continue
continue
}
case ')':
if (inClass || !patternListStack.length) {
case ')': {
const plEntry = patternListStack[patternListStack.length - 1]
if (inClass || !plEntry) {
re += '\\)'
continue
}
patternListStack.pop()
// closing an extglob
clearStateChar()
hasMagic = true
pl = patternListStack.pop()
pl = plEntry
// negation is (?:(?!js)[^/]*)

@@ -572,9 +595,10 @@ // The others are (?:<pattern>)<type>

if (pl.type === '!') {
negativeLists.push(pl)
negativeLists.push(Object.assign(pl, { reEnd: re.length }))
}
pl.reEnd = re.length
continue
continue
}
case '|':
if (inClass || !patternListStack.length) {
case '|': {
const plEntry = patternListStack[patternListStack.length - 1]
if (inClass || !plEntry) {
re += '\\|'

@@ -586,3 +610,9 @@ continue

re += '|'
continue
// next subpattern can start with a dot?
if (plEntry.start === 0 && plEntry.type !== '!') {
dotTravAllowed = true
re += subPatternStart(pattern.slice(i + 1))
}
continue
}

@@ -752,3 +782,3 @@ // these are mostly the same in regexp and glob

if (addPatternStart) {
re = patternStart + re
re = patternStart() + re
}

@@ -755,0 +785,0 @@

@@ -5,3 +5,3 @@ {

"description": "a glob matcher in javascript",
"version": "4.2.2",
"version": "4.2.3",
"publishConfig": {

@@ -8,0 +8,0 @@ "tag": "legacy-v4"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc