Comparing version 3.2.2 to 3.2.3
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0; | ||
const utils = require("../utils"); | ||
@@ -4,0 +5,0 @@ function generate(patterns, settings) { |
@@ -12,6 +12,6 @@ import { MicromatchOptions, EntryFilterFunction, Pattern } from '../../types'; | ||
private _isSkippedByDeep; | ||
private _getEntryLevel; | ||
private _isSkippedSymbolicLink; | ||
private _getEntryLevel; | ||
private _isSkippedByPositivePatterns; | ||
private _isSkippedByNegativePatterns; | ||
} |
@@ -23,4 +23,3 @@ "use strict"; | ||
_filter(basePath, entry, matcher, negativeRe) { | ||
const depth = this._getEntryLevel(basePath, entry.path); | ||
if (this._isSkippedByDeep(depth)) { | ||
if (this._isSkippedByDeep(basePath, entry.path)) { | ||
return false; | ||
@@ -37,20 +36,29 @@ } | ||
} | ||
_isSkippedByDeep(entryDepth) { | ||
return entryDepth >= this._settings.deep; | ||
_isSkippedByDeep(basePath, entryPath) { | ||
/** | ||
* Avoid unnecessary depth calculations when it doesn't matter. | ||
*/ | ||
if (this._settings.deep === Infinity) { | ||
return false; | ||
} | ||
return this._getEntryLevel(basePath, entryPath) >= this._settings.deep; | ||
} | ||
_getEntryLevel(basePath, entryPath) { | ||
const entryPathDepth = entryPath.split('/').length; | ||
if (basePath === '') { | ||
return entryPathDepth; | ||
} | ||
const basePathDepth = basePath.split('/').length; | ||
return entryPathDepth - basePathDepth; | ||
} | ||
_isSkippedSymbolicLink(entry) { | ||
return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink(); | ||
} | ||
_getEntryLevel(basePath, entryPath) { | ||
const basePathDepth = basePath.split('/').length; | ||
const entryPathDepth = entryPath.split('/').length; | ||
return entryPathDepth - (basePath === '' ? 0 : basePathDepth); | ||
} | ||
_isSkippedByPositivePatterns(entryPath, matcher) { | ||
return !this._settings.baseNameMatch && !matcher.match(entryPath); | ||
} | ||
_isSkippedByNegativePatterns(entryPath, negativeRe) { | ||
return !utils.pattern.matchAny(entryPath, negativeRe); | ||
_isSkippedByNegativePatterns(entryPath, patternsRe) { | ||
return !utils.pattern.matchAny(entryPath, patternsRe); | ||
} | ||
} | ||
exports.default = DeepFilter; |
@@ -16,7 +16,4 @@ "use strict"; | ||
_filter(entry, positiveRe, negativeRe) { | ||
if (this._settings.unique) { | ||
if (this._isDuplicateEntry(entry)) { | ||
return false; | ||
} | ||
this._createIndexRecord(entry); | ||
if (this._settings.unique && this._isDuplicateEntry(entry)) { | ||
return false; | ||
} | ||
@@ -26,7 +23,11 @@ if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) { | ||
} | ||
if (this._isSkippedByAbsoluteNegativePatterns(entry, negativeRe)) { | ||
if (this._isSkippedByAbsoluteNegativePatterns(entry.path, negativeRe)) { | ||
return false; | ||
} | ||
const filepath = this._settings.baseNameMatch ? entry.name : entry.path; | ||
return this._isMatchToPatterns(filepath, positiveRe) && !this._isMatchToPatterns(entry.path, negativeRe); | ||
const isMatched = this._isMatchToPatterns(filepath, positiveRe) && !this._isMatchToPatterns(entry.path, negativeRe); | ||
if (this._settings.unique && isMatched) { | ||
this._createIndexRecord(entry); | ||
} | ||
return isMatched; | ||
} | ||
@@ -45,8 +46,8 @@ _isDuplicateEntry(entry) { | ||
} | ||
_isSkippedByAbsoluteNegativePatterns(entry, negativeRe) { | ||
_isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) { | ||
if (!this._settings.absolute) { | ||
return false; | ||
} | ||
const fullpath = utils.path.makeAbsolute(this._settings.cwd, entry.path); | ||
return this._isMatchToPatterns(fullpath, negativeRe); | ||
const fullpath = utils.path.makeAbsolute(this._settings.cwd, entryPath); | ||
return utils.pattern.matchAny(fullpath, patternsRe); | ||
} | ||
@@ -53,0 +54,0 @@ _isMatchToPatterns(entryPath, patternsRe) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0; | ||
const fs = require("fs"); | ||
@@ -4,0 +5,0 @@ const os = require("os"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.splitWhen = exports.flatten = void 0; | ||
function flatten(items) { | ||
@@ -4,0 +5,0 @@ return items.reduce((collection, item) => [].concat(collection, item), []); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isEnoentCodeError = void 0; | ||
function isEnoentCodeError(error) { | ||
@@ -4,0 +5,0 @@ return error.code === 'ENOENT'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createDirentFromStats = void 0; | ||
class DirentFromStats { | ||
@@ -4,0 +5,0 @@ constructor(name, stats) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.string = exports.stream = exports.pattern = exports.path = exports.fs = exports.errno = exports.array = void 0; | ||
const array = require("./array"); | ||
@@ -4,0 +5,0 @@ exports.array = array; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.removeLeadingDotSegment = exports.escape = exports.makeAbsolute = exports.unixify = void 0; | ||
const path = require("path"); | ||
@@ -4,0 +5,0 @@ const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0; | ||
const path = require("path"); | ||
@@ -93,8 +94,19 @@ const globParent = require("glob-parent"); | ||
function getPatternParts(pattern, options) { | ||
const info = picomatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true })); | ||
// See micromatch/picomatch#58 for more details | ||
if (info.parts.length === 0) { | ||
return [pattern]; | ||
let { parts } = picomatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true })); | ||
/** | ||
* The scan method returns an empty array in some cases. | ||
* See micromatch/picomatch#58 for more details. | ||
*/ | ||
if (parts.length === 0) { | ||
parts = [pattern]; | ||
} | ||
return info.parts; | ||
/** | ||
* The scan method does not return an empty part for the pattern with a forward slash. | ||
* This is another part of micromatch/picomatch#58. | ||
*/ | ||
if (parts[0].startsWith('/')) { | ||
parts[0] = parts[0].slice(1); | ||
parts.unshift(''); | ||
} | ||
return parts; | ||
} | ||
@@ -101,0 +113,0 @@ exports.getPatternParts = getPatternParts; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.merge = void 0; | ||
const merge2 = require("merge2"); | ||
@@ -4,0 +5,0 @@ function merge(streams) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isEmpty = exports.isString = void 0; | ||
function isString(input) { | ||
@@ -4,0 +5,0 @@ return typeof input === 'string'; |
{ | ||
"name": "fast-glob", | ||
"version": "3.2.2", | ||
"version": "3.2.3", | ||
"description": "It's a very fast and efficient glob library for Node.js", | ||
@@ -28,2 +28,3 @@ "license": "MIT", | ||
"@types/glob-parent": "^5.1.0", | ||
"@types/is-ci": "^2.0.0", | ||
"@types/merge2": "^1.1.4", | ||
@@ -43,2 +44,4 @@ "@types/micromatch": "^4.0.0", | ||
"glob": "^7.1.4", | ||
"is-ci": "^2.0.0", | ||
"log-update": "^4.0.0", | ||
"minimist": "^1.2.0", | ||
@@ -45,0 +48,0 @@ "mocha": "^6.2.1", |
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
84165
1414
28