///
import * as fs from 'fs';
declare type ErrnoException$1 = NodeJS.ErrnoException;
declare type StatAsynchronousMethod = (path: string, callback: (error: ErrnoException$1 | null, stats: fs.Stats) => void) => void;
declare type StatSynchronousMethod = (path: string) => fs.Stats;
interface FileSystemAdapter$2 {
lstat: StatAsynchronousMethod;
stat: StatAsynchronousMethod;
lstatSync: StatSynchronousMethod;
statSync: StatSynchronousMethod;
}
interface Entry$2 {
dirent: Dirent;
name: string;
path: string;
stats?: Stats;
}
declare type Stats = fs.Stats;
declare type ErrnoException = NodeJS.ErrnoException;
interface Dirent {
isBlockDevice: () => boolean;
isCharacterDevice: () => boolean;
isDirectory: () => boolean;
isFIFO: () => boolean;
isFile: () => boolean;
isSocket: () => boolean;
isSymbolicLink: () => boolean;
name: string;
}
interface ReaddirAsynchronousMethod {
(filepath: string, options: {
withFileTypes: true;
}, callback: (error: ErrnoException | null, files: Dirent[]) => void): void;
(filepath: string, callback: (error: ErrnoException | null, files: string[]) => void): void;
}
interface ReaddirSynchronousMethod {
(filepath: string, options: {
withFileTypes: true;
}): Dirent[];
(filepath: string): string[];
}
declare type FileSystemAdapter$1 = FileSystemAdapter$2 & {
readdir: ReaddirAsynchronousMethod;
readdirSync: ReaddirSynchronousMethod;
};
declare type Entry$1 = Entry$2;
type Entry = Entry$1;
type Pattern = string;
type FileSystemAdapter = FileSystemAdapter$1;
type Options = {
/**
* Return the absolute path for entries.
*
* @default false
*/
absolute?: boolean;
/**
* If set to `true`, then patterns without slashes will be matched against
* the basename of the path if it contains slashes.
*
* @default false
*/
baseNameMatch?: boolean;
/**
* Enables Bash-like brace expansion.
*
* @default true
*/
braceExpansion?: boolean;
/**
* Enables a case-sensitive mode for matching files.
*
* @default true
*/
caseSensitiveMatch?: boolean;
/**
* Specifies the maximum number of concurrent requests from a reader to read
* directories.
*
* @default os.cpus().length
*/
concurrency?: number;
/**
* The current working directory in which to search.
*
* @default process.cwd()
*/
cwd?: string;
/**
* Specifies the maximum depth of a read directory relative to the start
* directory.
*
* @default Infinity
*/
deep?: number;
/**
* Allow patterns to match entries that begin with a period (`.`).
*
* @default false
*/
dot?: boolean;
/**
* Enables Bash-like `extglob` functionality.
*
* @default true
*/
extglob?: boolean;
/**
* Indicates whether to traverse descendants of symbolic link directories.
*
* @default true
*/
followSymbolicLinks?: boolean;
/**
* Custom implementation of methods for working with the file system.
*
* @default fs.*
*/
fs?: Partial;
/**
* Enables recursively repeats a pattern containing `**`.
* If `false`, `**` behaves exactly like `*`.
*
* @default true
*/
globstar?: boolean;
/**
* An array of glob patterns to exclude matches.
* This is an alternative way to use negative patterns.
*
* @default []
*/
ignore?: Pattern[];
/**
* Mark the directory path with the final slash.
*
* @default false
*/
markDirectories?: boolean;
/**
* Returns objects (instead of strings) describing entries.
*
* @default false
*/
objectMode?: boolean;
/**
* Return only directories.
*
* @default false
*/
onlyDirectories?: boolean;
/**
* Return only files.
*
* @default true
*/
onlyFiles?: boolean;
/**
* Enables an object mode (`objectMode`) with an additional `stats` field.
*
* @default false
*/
stats?: boolean;
/**
* By default this package suppress only `ENOENT` errors.
* Set to `true` to suppress any error.
*
* @default false
*/
suppressErrors?: boolean;
/**
* Throw an error when symbolic link is broken if `true` or safely
* return `lstat` call if `false`.
*
* @default false
*/
throwErrorOnBrokenSymbolicLink?: boolean;
/**
* Ensures that the returned entries are unique.
*
* @default true
*/
unique?: boolean;
};
type Task = {
base: string;
dynamic: boolean;
patterns: Pattern[];
positive: Pattern[];
negative: Pattern[];
};
type EntryObjectModePredicate = {
[TKey in keyof Pick]-?: true;
};
type EntryStatsPredicate = {
[TKey in keyof Pick]-?: true;
};
type EntryObjectPredicate = EntryObjectModePredicate | EntryStatsPredicate;
declare function FastGlob(source: Pattern | Pattern[], options: Options & EntryObjectPredicate): Promise;
declare function FastGlob(source: Pattern | Pattern[], options?: Options): Promise;
declare namespace FastGlob {
type Options = Options;
type Entry = Entry;
type Task = Task;
type Pattern = Pattern;
type FileSystemAdapter = FileSystemAdapter;
const glob: typeof FastGlob;
const globSync: typeof sync;
const globStream: typeof stream;
const async: typeof FastGlob;
function sync(source: Pattern | Pattern[], options: Options & EntryObjectPredicate): Entry[];
function sync(source: Pattern | Pattern[], options?: Options): string[];
function stream(source: Pattern | Pattern[], options?: Options): NodeJS.ReadableStream;
function generateTasks(source: Pattern | Pattern[], options?: Options): Task[];
function isDynamicPattern(source: Pattern, options?: Options): boolean;
function escapePath(source: string): Pattern;
function convertPathToPattern(source: string): Pattern;
namespace posix {
function escapePath(source: string): Pattern;
function convertPathToPattern(source: string): Pattern;
}
namespace win32 {
function escapePath(source: string): Pattern;
function convertPathToPattern(source: string): Pattern;
}
}
export { FastGlob as default };