Comparing version 3.2.1 to 3.2.2
@@ -30,6 +30,7 @@ "use strict"; | ||
} | ||
if (this._isSkippedByPositivePatterns(entry, matcher)) { | ||
const filepath = utils.path.removeLeadingDotSegment(entry.path); | ||
if (this._isSkippedByPositivePatterns(filepath, matcher)) { | ||
return false; | ||
} | ||
return this._isSkippedByNegativePatterns(entry, negativeRe); | ||
return this._isSkippedByNegativePatterns(filepath, negativeRe); | ||
} | ||
@@ -47,9 +48,9 @@ _isSkippedByDeep(entryDepth) { | ||
} | ||
_isSkippedByPositivePatterns(entry, matcher) { | ||
return !this._settings.baseNameMatch && !matcher.match(entry.path); | ||
_isSkippedByPositivePatterns(entryPath, matcher) { | ||
return !this._settings.baseNameMatch && !matcher.match(entryPath); | ||
} | ||
_isSkippedByNegativePatterns(entry, negativeRe) { | ||
return !utils.pattern.matchAny(entry.path, negativeRe); | ||
_isSkippedByNegativePatterns(entryPath, negativeRe) { | ||
return !utils.pattern.matchAny(entryPath, negativeRe); | ||
} | ||
} | ||
exports.default = DeepFilter; |
@@ -50,3 +50,4 @@ "use strict"; | ||
} | ||
_isMatchToPatterns(filepath, patternsRe) { | ||
_isMatchToPatterns(entryPath, patternsRe) { | ||
const filepath = utils.path.removeLeadingDotSegment(entryPath); | ||
return utils.pattern.matchAny(filepath, patternsRe); | ||
@@ -53,0 +54,0 @@ } |
@@ -8,1 +8,2 @@ import { Pattern } from '../types'; | ||
export declare function escape(pattern: Pattern): Pattern; | ||
export declare function removeLeadingDotSegment(entry: string): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const path = require("path"); | ||
const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\ | ||
const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g; | ||
@@ -20,1 +21,13 @@ /** | ||
exports.escape = escape; | ||
function removeLeadingDotSegment(entry) { | ||
// We do not use `startsWith` because this is 10x slower than current implementation for some cases. | ||
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with | ||
if (entry.charAt(0) === '.') { | ||
const secondCharactery = entry.charAt(1); | ||
if (secondCharactery === '/' || secondCharactery === '\\') { | ||
return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT); | ||
} | ||
} | ||
return entry; | ||
} | ||
exports.removeLeadingDotSegment = removeLeadingDotSegment; |
@@ -110,5 +110,4 @@ "use strict"; | ||
function matchAny(entry, patternsRe) { | ||
const filepath = entry.replace(/^\.[/\\]/, ''); | ||
return patternsRe.some((patternRe) => patternRe.test(filepath)); | ||
return patternsRe.some((patternRe) => patternRe.test(entry)); | ||
} | ||
exports.matchAny = matchAny; |
{ | ||
"name": "fast-glob", | ||
"version": "3.2.1", | ||
"version": "3.2.2", | ||
"description": "It's a very fast and efficient glob library for Node.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82187
1383