Skip to content

Commit

Permalink
fix: remove performance cliff for glob extension regex
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmlnc committed Jan 7, 2022
1 parent 5669fab commit 4f5ff66
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/utils/pattern.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ describe('Utils → Pattern', () => {

it('should return false for unfinished glob extension', () => {
assert.ok(!util.isDynamicPattern('@('));
assert.ok(!util.isDynamicPattern('@' + '('.repeat(999999) + 'a'));
assert.ok(!util.isDynamicPattern('@(a'));
assert.ok(!util.isDynamicPattern('@(a|'));
assert.ok(!util.isDynamicPattern('@(a|b'));
Expand Down
2 changes: 1 addition & 1 deletion src/utils/pattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const ESCAPE_SYMBOL = '\\';
const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\(.*\)/;
const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
const BRACE_EXPANSIONS_SYMBOLS_RE = /{[^,.{]*(?:,|\.\.)[^,.{]*}/;

type PatternTypeOptions = {
Expand Down

0 comments on commit 4f5ff66

Please sign in to comment.