diff --git a/package-lock.json b/package-lock.json index bc87a5c7..ae46e5df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "minimatch", - "version": "6.1.3", + "version": "6.1.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "minimatch", - "version": "6.1.3", + "version": "6.1.4", "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" diff --git a/package.json b/package.json index 440eaad7..804a2c30 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Isaac Z. Schlueter (http://blog.izs.me)", "name": "minimatch", "description": "a glob matcher in javascript", - "version": "6.1.3", + "version": "6.1.4", "repository": { "type": "git", "url": "git://github.com/isaacs/minimatch.git" diff --git a/src/index.ts b/src/index.ts index 9941efbf..78232006 100644 --- a/src/index.ts +++ b/src/index.ts @@ -760,11 +760,12 @@ export class Minimatch { } case ')': { - const plEntry = patternListStack.pop() + const plEntry = patternListStack[patternListStack.length - 1] if (inClass || !plEntry) { re += '\\)' continue } + patternListStack.pop() // closing an extglob clearStateChar() diff --git a/tap-snapshots/test/basic.js.test.cjs b/tap-snapshots/test/basic.js.test.cjs index 1af77ff1..e0eb6cd2 100644 --- a/tap-snapshots/test/basic.js.test.cjs +++ b/tap-snapshots/test/basic.js.test.cjs @@ -193,6 +193,14 @@ exports[`test/basic.js TAP basic tests > makeRe @(.*|js) 1`] = ` /^(?:(?=.)(?:\\.[^/]*?|(?!\\.)js))$/ ` +exports[`test/basic.js TAP basic tests > makeRe @(a|a[(])b 1`] = ` +/^(?:(?=.)(?:(?!\\.)a|(?!\\.)a[(])b)$/ +` + +exports[`test/basic.js TAP basic tests > makeRe @(a|a[)])b 1`] = ` +/^(?:(?=.)(?:(?!\\.)a|(?!\\.)a[\\)])b)$/ +` + exports[`test/basic.js TAP basic tests > makeRe @(js|.*) 1`] = ` /^(?:(?=.)(?:(?!\\.)js|\\.[^/]*?))$/ ` diff --git a/test/patterns.js b/test/patterns.js index fddbe812..bbef1cc9 100644 --- a/test/patterns.js +++ b/test/patterns.js @@ -336,6 +336,9 @@ module.exports = [ // doesn't start at 0, no dice // neg extglobs don't trigger this behavior. ['!(.a|js)@(.*)', ['a.js'], { nonegate: true }], + () => files=['a(b', 'ab', 'a)b'], + ['@(a|a[(])b', ['a(b', 'ab']], + ['@(a|a[)])b', ['a)b', 'ab']], ] Object.defineProperty(module.exports, 'files', {