aboutsummaryrefslogtreecommitdiff
path: root/node_modules/fast-glob/out/providers/filters
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/fast-glob/out/providers/filters')
-rw-r--r--node_modules/fast-glob/out/providers/filters/deep.d.ts45
-rw-r--r--node_modules/fast-glob/out/providers/filters/deep.js83
-rw-r--r--node_modules/fast-glob/out/providers/filters/entry.d.ts45
-rw-r--r--node_modules/fast-glob/out/providers/filters/entry.js85
4 files changed, 258 insertions, 0 deletions
diff --git a/node_modules/fast-glob/out/providers/filters/deep.d.ts b/node_modules/fast-glob/out/providers/filters/deep.d.ts
new file mode 100644
index 0000000..2cd02b6
--- /dev/null
+++ b/node_modules/fast-glob/out/providers/filters/deep.d.ts
@@ -0,0 +1,45 @@
+import micromatch = require('micromatch');
+import { IOptions } from '../../managers/options';
+import { FilterFunction } from '@mrmlnc/readdir-enhanced';
+import { Pattern } from '../../types/patterns';
+export default class DeepFilter {
+ private readonly options;
+ private readonly micromatchOptions;
+ constructor(options: IOptions, micromatchOptions: micromatch.Options);
+ /**
+ * Returns filter for directories.
+ */
+ getFilter(positive: Pattern[], negative: Pattern[]): FilterFunction;
+ /**
+ * Returns max depth of the provided patterns.
+ */
+ private getMaxPatternDepth;
+ /**
+ * Returns RegExp's for patterns that can affect the depth of reading.
+ */
+ private getNegativePatternsRe;
+ /**
+ * Returns «true» for directory that should be read.
+ */
+ private filter;
+ /**
+ * Returns «true» when the «deep» option is disabled or number and depth of the entry is greater that the option value.
+ */
+ private isSkippedByDeepOption;
+ /**
+ * Returns «true» when depth parameter is not an Infinity and entry depth greater that the parameter value.
+ */
+ private isSkippedByMaxPatternDepth;
+ /**
+ * Returns «true» for symlinked directory if the «followSymlinkedDirectories» option is disabled.
+ */
+ private isSkippedSymlinkedDirectory;
+ /**
+ * Returns «true» for a directory whose name starts with a period if «dot» option is disabled.
+ */
+ private isSkippedDotDirectory;
+ /**
+ * Returns «true» for a directory whose path math to any negative pattern.
+ */
+ private isSkippedByNegativePatterns;
+}
diff --git a/node_modules/fast-glob/out/providers/filters/deep.js b/node_modules/fast-glob/out/providers/filters/deep.js
new file mode 100644
index 0000000..19732e8
--- /dev/null
+++ b/node_modules/fast-glob/out/providers/filters/deep.js
@@ -0,0 +1,83 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var pathUtils = require("../../utils/path");
+var patternUtils = require("../../utils/pattern");
+var DeepFilter = /** @class */ (function () {
+ function DeepFilter(options, micromatchOptions) {
+ this.options = options;
+ this.micromatchOptions = micromatchOptions;
+ }
+ /**
+ * Returns filter for directories.
+ */
+ DeepFilter.prototype.getFilter = function (positive, negative) {
+ var _this = this;
+ var maxPatternDepth = this.getMaxPatternDepth(positive);
+ var negativeRe = this.getNegativePatternsRe(negative);
+ return function (entry) { return _this.filter(entry, negativeRe, maxPatternDepth); };
+ };
+ /**
+ * Returns max depth of the provided patterns.
+ */
+ DeepFilter.prototype.getMaxPatternDepth = function (patterns) {
+ var globstar = patterns.some(patternUtils.hasGlobStar);
+ return globstar ? Infinity : patternUtils.getMaxNaivePatternsDepth(patterns);
+ };
+ /**
+ * Returns RegExp's for patterns that can affect the depth of reading.
+ */
+ DeepFilter.prototype.getNegativePatternsRe = function (patterns) {
+ var affectDepthOfReadingPatterns = patterns.filter(patternUtils.isAffectDepthOfReadingPattern);
+ return patternUtils.convertPatternsToRe(affectDepthOfReadingPatterns, this.micromatchOptions);
+ };
+ /**
+ * Returns «true» for directory that should be read.
+ */
+ DeepFilter.prototype.filter = function (entry, negativeRe, maxPatternDepth) {
+ if (this.isSkippedByDeepOption(entry.depth)) {
+ return false;
+ }
+ if (this.isSkippedByMaxPatternDepth(entry.depth, maxPatternDepth)) {
+ return false;
+ }
+ if (this.isSkippedSymlinkedDirectory(entry)) {
+ return false;
+ }
+ if (this.isSkippedDotDirectory(entry)) {
+ return false;
+ }
+ return this.isSkippedByNegativePatterns(entry, negativeRe);
+ };
+ /**
+ * Returns «true» when the «deep» option is disabled or number and depth of the entry is greater that the option value.
+ */
+ DeepFilter.prototype.isSkippedByDeepOption = function (entryDepth) {
+ return !this.options.deep || (typeof this.options.deep === 'number' && entryDepth >= this.options.deep);
+ };
+ /**
+ * Returns «true» when depth parameter is not an Infinity and entry depth greater that the parameter value.
+ */
+ DeepFilter.prototype.isSkippedByMaxPatternDepth = function (entryDepth, maxPatternDepth) {
+ return maxPatternDepth !== Infinity && entryDepth >= maxPatternDepth;
+ };
+ /**
+ * Returns «true» for symlinked directory if the «followSymlinkedDirectories» option is disabled.
+ */
+ DeepFilter.prototype.isSkippedSymlinkedDirectory = function (entry) {
+ return !this.options.followSymlinkedDirectories && entry.isSymbolicLink();
+ };
+ /**
+ * Returns «true» for a directory whose name starts with a period if «dot» option is disabled.
+ */
+ DeepFilter.prototype.isSkippedDotDirectory = function (entry) {
+ return !this.options.dot && pathUtils.isDotDirectory(entry.path);
+ };
+ /**
+ * Returns «true» for a directory whose path math to any negative pattern.
+ */
+ DeepFilter.prototype.isSkippedByNegativePatterns = function (entry, negativeRe) {
+ return !patternUtils.matchAny(entry.path, negativeRe);
+ };
+ return DeepFilter;
+}());
+exports.default = DeepFilter;
diff --git a/node_modules/fast-glob/out/providers/filters/entry.d.ts b/node_modules/fast-glob/out/providers/filters/entry.d.ts
new file mode 100644
index 0000000..88806af
--- /dev/null
+++ b/node_modules/fast-glob/out/providers/filters/entry.d.ts
@@ -0,0 +1,45 @@
+import micromatch = require('micromatch');
+import { IOptions } from '../../managers/options';
+import { FilterFunction } from '@mrmlnc/readdir-enhanced';
+import { Pattern } from '../../types/patterns';
+export default class DeepFilter {
+ private readonly options;
+ private readonly micromatchOptions;
+ readonly index: Map<string, undefined>;
+ constructor(options: IOptions, micromatchOptions: micromatch.Options);
+ /**
+ * Returns filter for directories.
+ */
+ getFilter(positive: Pattern[], negative: Pattern[]): FilterFunction;
+ /**
+ * Returns true if entry must be added to result.
+ */
+ private filter;
+ /**
+ * Return true if the entry already has in the cross reader index.
+ */
+ private isDuplicateEntry;
+ /**
+ * Create record in the cross reader index.
+ */
+ private createIndexRecord;
+ /**
+ * Returns true for non-files if the «onlyFiles» option is enabled.
+ */
+ private onlyFileFilter;
+ /**
+ * Returns true for non-directories if the «onlyDirectories» option is enabled.
+ */
+ private onlyDirectoryFilter;
+ /**
+ * Return true when `absolute` option is enabled and matched to the negative patterns.
+ */
+ private isSkippedByAbsoluteNegativePatterns;
+ /**
+ * Return true when entry match to provided patterns.
+ *
+ * First, just trying to apply patterns to the path.
+ * Second, trying to apply patterns to the path with final slash (need to micromatch to support «directory/**» patterns).
+ */
+ private isMatchToPatterns;
+}
diff --git a/node_modules/fast-glob/out/providers/filters/entry.js b/node_modules/fast-glob/out/providers/filters/entry.js
new file mode 100644
index 0000000..aa68541
--- /dev/null
+++ b/node_modules/fast-glob/out/providers/filters/entry.js
@@ -0,0 +1,85 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var pathUtils = require("../../utils/path");
+var patternUtils = require("../../utils/pattern");
+var DeepFilter = /** @class */ (function () {
+ function DeepFilter(options, micromatchOptions) {
+ this.options = options;
+ this.micromatchOptions = micromatchOptions;
+ this.index = new Map();
+ }
+ /**
+ * Returns filter for directories.
+ */
+ DeepFilter.prototype.getFilter = function (positive, negative) {
+ var _this = this;
+ var positiveRe = patternUtils.convertPatternsToRe(positive, this.micromatchOptions);
+ var negativeRe = patternUtils.convertPatternsToRe(negative, this.micromatchOptions);
+ return function (entry) { return _this.filter(entry, positiveRe, negativeRe); };
+ };
+ /**
+ * Returns true if entry must be added to result.
+ */
+ DeepFilter.prototype.filter = function (entry, positiveRe, negativeRe) {
+ // Exclude duplicate results
+ if (this.options.unique) {
+ if (this.isDuplicateEntry(entry)) {
+ return false;
+ }
+ this.createIndexRecord(entry);
+ }
+ // Filter files and directories by options
+ if (this.onlyFileFilter(entry) || this.onlyDirectoryFilter(entry)) {
+ return false;
+ }
+ if (this.isSkippedByAbsoluteNegativePatterns(entry, negativeRe)) {
+ return false;
+ }
+ return this.isMatchToPatterns(entry.path, positiveRe) && !this.isMatchToPatterns(entry.path, negativeRe);
+ };
+ /**
+ * Return true if the entry already has in the cross reader index.
+ */
+ DeepFilter.prototype.isDuplicateEntry = function (entry) {
+ return this.index.has(entry.path);
+ };
+ /**
+ * Create record in the cross reader index.
+ */
+ DeepFilter.prototype.createIndexRecord = function (entry) {
+ this.index.set(entry.path, undefined);
+ };
+ /**
+ * Returns true for non-files if the «onlyFiles» option is enabled.
+ */
+ DeepFilter.prototype.onlyFileFilter = function (entry) {
+ return this.options.onlyFiles && !entry.isFile();
+ };
+ /**
+ * Returns true for non-directories if the «onlyDirectories» option is enabled.
+ */
+ DeepFilter.prototype.onlyDirectoryFilter = function (entry) {
+ return this.options.onlyDirectories && !entry.isDirectory();
+ };
+ /**
+ * Return true when `absolute` option is enabled and matched to the negative patterns.
+ */
+ DeepFilter.prototype.isSkippedByAbsoluteNegativePatterns = function (entry, negativeRe) {
+ if (!this.options.absolute) {
+ return false;
+ }
+ var fullpath = pathUtils.makeAbsolute(this.options.cwd, entry.path);
+ return this.isMatchToPatterns(fullpath, negativeRe);
+ };
+ /**
+ * Return true when entry match to provided patterns.
+ *
+ * First, just trying to apply patterns to the path.
+ * Second, trying to apply patterns to the path with final slash (need to micromatch to support «directory/**» patterns).
+ */
+ DeepFilter.prototype.isMatchToPatterns = function (filepath, patternsRe) {
+ return patternUtils.matchAny(filepath, patternsRe) || patternUtils.matchAny(filepath + '/', patternsRe);
+ };
+ return DeepFilter;
+}());
+exports.default = DeepFilter;