Comparing version 14.0.2 to 14.1.0
@@ -208,1 +208,49 @@ import type FastGlob from 'fast-glob'; | ||
export function convertPathToPattern(source: string): FastGlob.Pattern; | ||
/** | ||
Check if a path is ignored by the ignore files. | ||
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns). | ||
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package. | ||
@returns A filter function indicating whether a given path is ignored via the ignore files. | ||
This 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. | ||
@example | ||
``` | ||
import {isIgnoredByIgnoreFiles} from 'globby'; | ||
const isIgnored = await isIgnoredByIgnoreFiles('**\/.gitignore'); | ||
console.log(isIgnored('some/file')); | ||
``` | ||
*/ | ||
export function isIgnoredByIgnoreFiles( | ||
patterns: string | readonly string[], | ||
options?: Options | ||
): Promise<GlobbyFilterFunction>; | ||
/** | ||
Check if a path is ignored by the ignore files. | ||
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns). | ||
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package. | ||
@returns A filter function indicating whether a given path is ignored via the ignore files. | ||
This 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. | ||
@see {@link isIgnoredByIgnoreFiles} | ||
@example | ||
``` | ||
import {isIgnoredByIgnoreFilesSync} from 'globby'; | ||
const isIgnored = isIgnoredByIgnoreFilesSync('**\/.gitignore'); | ||
console.log(isIgnored('some/file')); | ||
``` | ||
*/ | ||
export function isIgnoredByIgnoreFilesSync( | ||
patterns: string | readonly string[], | ||
options?: Options | ||
): GlobbyFilterFunction; |
@@ -262,4 +262,6 @@ import process from 'node:process'; | ||
isGitIgnoredSync, | ||
isIgnoredByIgnoreFiles, | ||
isIgnoredByIgnoreFilesSync, | ||
} from './ignore.js'; | ||
export const {convertPathToPattern} = fastGlob; |
{ | ||
"name": "globby", | ||
"version": "14.0.2", | ||
"version": "14.1.0", | ||
"description": "User-friendly glob matching", | ||
@@ -67,11 +67,11 @@ "license": "MIT", | ||
"@sindresorhus/merge-streams": "^2.1.0", | ||
"fast-glob": "^3.3.2", | ||
"ignore": "^5.2.4", | ||
"path-type": "^5.0.0", | ||
"fast-glob": "^3.3.3", | ||
"ignore": "^7.0.3", | ||
"path-type": "^6.0.0", | ||
"slash": "^5.1.0", | ||
"unicorn-magic": "^0.1.0" | ||
"unicorn-magic": "^0.3.0" | ||
}, | ||
"devDependencies": { | ||
"@globby/main-branch": "sindresorhus/globby#main", | ||
"@types/node": "^20.9.0", | ||
"@types/node": "^22.13.1", | ||
"ava": "^5.3.1", | ||
@@ -81,4 +81,4 @@ "benchmark": "2.1.4", | ||
"tempy": "^3.1.0", | ||
"tsd": "^0.30.4", | ||
"xo": "^0.57.0" | ||
"tsd": "^0.31.2", | ||
"xo": "^0.60.0" | ||
}, | ||
@@ -85,0 +85,0 @@ "xo": { |
@@ -160,2 +160,35 @@ # globby | ||
### isIgnoredByIgnoreFiles(patterns, options?) | ||
Returns a `Promise<(path: URL | string) => boolean>` indicating whether a given path is ignored via the ignore files. | ||
This 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. | ||
Takes `cwd?: URL | string` as options. | ||
```js | ||
import {isIgnoredByIgnoreFiles} from 'globby'; | ||
const isIgnored = await isIgnoredByIgnoreFiles("**/.gitignore"); | ||
console.log(isIgnored('some/file')); | ||
``` | ||
### isIgnoredByIgnoreFilesSync(patterns, options?) | ||
Returns a `(path: URL | string) => boolean` indicating whether a given path is ignored via the ignore files. | ||
This is a more generic form of the `isGitIgnoredSync` 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. | ||
Takes `cwd?: URL | string` as options. | ||
```js | ||
import {isIgnoredByIgnoreFilesSync} from 'globby'; | ||
const isIgnored = isIgnoredByIgnoreFilesSync("**/.gitignore"); | ||
console.log(isIgnored('some/file')); | ||
``` | ||
## Globbing patterns | ||
@@ -162,0 +195,0 @@ |
28993
494
211
+ Addedignore@7.0.3(transitive)
+ Addedpath-type@6.0.0(transitive)
+ Addedunicorn-magic@0.3.0(transitive)
- Removedignore@5.3.2(transitive)
- Removedpath-type@5.0.0(transitive)
- Removedunicorn-magic@0.1.0(transitive)
Updatedfast-glob@^3.3.3
Updatedignore@^7.0.3
Updatedpath-type@^6.0.0
Updatedunicorn-magic@^0.3.0