basant307/AI_Governance_Project
045
1import type FastGlob from 'fast-glob';2 3export type GlobEntry = FastGlob.Entry;4 5export type GlobTask = {6 readonly patterns: string[];7 readonly options: Options;8};9 10export type ExpandDirectoriesOption =11 | boolean12 | readonly string[]13 | {files?: readonly string[]; extensions?: readonly string[]};14 15type FastGlobOptionsWithoutCwd = Omit<FastGlob.Options, 'cwd'>;16 17export type Options = {18 /**19 If set to `true`, `globby` will automatically glob directories for you. If you define an `Array` it will only glob files that matches the patterns inside the `Array`. You can also define an `Object` with `files` and `extensions` like in the example below.20 21 Note that if you set this option to `false`, you won't get back matched directories unless you set `onlyFiles: false`.22 23 @default true24 25 @example26 ```27 import {globby} from 'globby';28 29 const paths = await globby('images', {30 expandDirectories: {31 files: ['cat', 'unicorn', '*.jpg'],32 extensions: ['png']33 }34 });35 36 console.log(paths);37 //=> ['cat.png', 'unicorn.png', 'cow.jpg', 'rainbow.jpg']38 ```39 */40 readonly expandDirectories?: ExpandDirectoriesOption;41 42 /**43 Respect ignore patterns in `.gitignore` files that apply to the globbed files.44 45 @default false46 */47 readonly gitignore?: boolean;48 49 /**50 Glob patterns to look for ignore files, which are then used to ignore globbed files.51 52 This is a more generic form of the `gitignore` option, allowing you to find ignore files with a [compatible syntax](http://git-scm.com/docs/gitignore). For instance, this works with Babel's `.babelignore`, Prettier's `.prettierignore`, or ESLint's `.eslintignore` files.53 54 @default undefined55 */56 readonly ignoreFiles?: string | readonly string[];57 58 /**59 The current working directory in which to search.60 61 @default process.cwd()62 */63 readonly cwd?: URL | string;64} & FastGlobOptionsWithoutCwd;65 66export type GitignoreOptions = {67 readonly cwd?: URL | string;68};69 70export type GlobbyFilterFunction = (path: URL | string) => boolean;71 72/**73Find files and directories using glob patterns.74 75Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.76 77@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).78@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.79@returns The matching paths.80 81@example82```83import {globby} from 'globby';84 85const paths = await globby(['*', '!cake']);86 87console.log(paths);88//=> ['unicorn', 'rainbow']89```90*/91export function globby(92 patterns: string | readonly string[],93 options: Options & {objectMode: true}94): Promise<GlobEntry[]>;95export function globby(96 patterns: string | readonly string[],97 options?: Options98): Promise<string[]>;99 100/**101Find files and directories using glob patterns.102 103Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.104 105@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).106@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.107@returns The matching paths.108*/109export function globbySync(110 patterns: string | readonly string[],111 options: Options & {objectMode: true}112): GlobEntry[];113export function globbySync(114 patterns: string | readonly string[],115 options?: Options116): string[];117 118/**119Find files and directories using glob patterns.120 121Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.122 123@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).124@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.125@returns The stream of matching paths.126 127@example128```129import {globbyStream} from 'globby';130 131for await (const path of globbyStream('*.tmp')) {132 console.log(path);133}134```135*/136export function globbyStream(137 patterns: string | readonly string[],138 options?: Options139): NodeJS.ReadableStream;140 141/**142Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration.143 144@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).145@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.146@returns An object in the format `{pattern: string, options: object}`, which can be passed as arguments to [`fast-glob`](https://github.com/mrmlnc/fast-glob). This is useful for other globbing-related packages.147*/148export function generateGlobTasks(149 patterns: string | readonly string[],150 options?: Options151): Promise<GlobTask[]>;152 153/**154@see generateGlobTasks155 156@returns An object in the format `{pattern: string, options: object}`, which can be passed as arguments to [`fast-glob`](https://github.com/mrmlnc/fast-glob). This is useful for other globbing-related packages.157*/158export function generateGlobTasksSync(159 patterns: string | readonly string[],160 options?: Options161): GlobTask[];162 163/**164Note that the options affect the results.165 166This function is backed by [`fast-glob`](https://github.com/mrmlnc/fast-glob#isdynamicpatternpattern-options).167 168@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).169@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3).170@returns Whether there are any special glob characters in the `patterns`.171*/172export function isDynamicPattern(173 patterns: string | readonly string[],174 options?: FastGlobOptionsWithoutCwd & {175 /**176 The current working directory in which to search.177 178 @default process.cwd()179 */180 readonly cwd?: URL | string;181 }182): boolean;183 184/**185`.gitignore` files matched by the ignore config are not used for the resulting filter function.186 187@returns A filter function indicating whether a given path is ignored via a `.gitignore` file.188 189@example190```191import {isGitIgnored} from 'globby';192 193const isIgnored = await isGitIgnored();194 195console.log(isIgnored('some/file'));196```197*/198export function isGitIgnored(options?: GitignoreOptions): Promise<GlobbyFilterFunction>;199 200/**201@see isGitIgnored202 203@returns A filter function indicating whether a given path is ignored via a `.gitignore` file.204*/205export function isGitIgnoredSync(options?: GitignoreOptions): GlobbyFilterFunction;206 207export function convertPathToPattern(source: string): FastGlob.Pattern;208 209/**210Check if a path is ignored by the ignore files.211 212@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).213@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.214@returns A filter function indicating whether a given path is ignored via the ignore files.215 216This is a more generic form of the `isGitIgnored` function, allowing you to find ignore files with a [compatible syntax](http://git-scm.com/docs/gitignore). For instance, this works with Babel's `.babelignore`, Prettier's `.prettierignore`, or ESLint's `.eslintignore` files.217 218@example219```220import {isIgnoredByIgnoreFiles} from 'globby';221 222const isIgnored = await isIgnoredByIgnoreFiles('**\/.gitignore');223 224console.log(isIgnored('some/file'));225```226*/227export function isIgnoredByIgnoreFiles(228 patterns: string | readonly string[],229 options?: Options230): Promise<GlobbyFilterFunction>;231 232/**233Check if a path is ignored by the ignore files.234 235@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).236@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.237@returns A filter function indicating whether a given path is ignored via the ignore files.238 239This is a more generic form of the `isGitIgnored` function, allowing you to find ignore files with a [compatible syntax](http://git-scm.com/docs/gitignore). For instance, this works with Babel's `.babelignore`, Prettier's `.prettierignore`, or ESLint's `.eslintignore` files.240 241@see {@link isIgnoredByIgnoreFiles}242 243@example244```245import {isIgnoredByIgnoreFilesSync} from 'globby';246 247const isIgnored = isIgnoredByIgnoreFilesSync('**\/.gitignore');248 249console.log(isIgnored('some/file'));250```251*/252export function isIgnoredByIgnoreFilesSync(253 patterns: string | readonly string[],254 options?: Options255): GlobbyFilterFunction;256 