globby
Advanced tools
Comparing version 11.0.4 to 12.0.0
@@ -1,8 +0,7 @@ | ||
'use strict'; | ||
const {promisify} = require('util'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const fastGlob = require('fast-glob'); | ||
const gitIgnore = require('ignore'); | ||
const slash = require('slash'); | ||
import {promisify} from 'node:util'; | ||
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
import fastGlob from 'fast-glob'; | ||
import gitIgnore from 'ignore'; | ||
import slash from 'slash'; | ||
@@ -13,3 +12,3 @@ const DEFAULT_IGNORE = [ | ||
'**/coverage/**', | ||
'**/.git' | ||
'**/.git', | ||
]; | ||
@@ -42,3 +41,3 @@ | ||
cwd: file.cwd, | ||
fileName: file.filePath | ||
fileName: file.filePath, | ||
})); | ||
@@ -63,5 +62,3 @@ } | ||
const getIsIgnoredPredecate = (ignores, cwd) => { | ||
return p => ignores.ignores(slash(path.relative(cwd, ensureAbsolutePathForCwd(cwd, p.path || p)))); | ||
}; | ||
const getIsIgnoredPredicate = (ignores, cwd) => p => ignores.ignores(slash(path.relative(cwd, ensureAbsolutePathForCwd(cwd, p.path || p)))); | ||
@@ -75,3 +72,3 @@ const getFile = async (file, cwd) => { | ||
filePath, | ||
content | ||
content, | ||
}; | ||
@@ -87,3 +84,3 @@ }; | ||
filePath, | ||
content | ||
content, | ||
}; | ||
@@ -94,8 +91,6 @@ }; | ||
ignore = [], | ||
cwd = slash(process.cwd()) | ||
} = {}) => { | ||
return {ignore, cwd}; | ||
}; | ||
cwd = slash(process.cwd()), | ||
} = {}) => ({ignore, cwd}); | ||
module.exports = async options => { | ||
export const isGitIgnored = async options => { | ||
options = normalizeOptions(options); | ||
@@ -105,3 +100,3 @@ | ||
ignore: DEFAULT_IGNORE.concat(options.ignore), | ||
cwd: options.cwd | ||
cwd: options.cwd, | ||
}); | ||
@@ -112,6 +107,6 @@ | ||
return getIsIgnoredPredecate(ignores, options.cwd); | ||
return getIsIgnoredPredicate(ignores, options.cwd); | ||
}; | ||
module.exports.sync = options => { | ||
export const isGitIgnoredSync = options => { | ||
options = normalizeOptions(options); | ||
@@ -121,3 +116,3 @@ | ||
ignore: DEFAULT_IGNORE.concat(options.ignore), | ||
cwd: options.cwd | ||
cwd: options.cwd, | ||
}); | ||
@@ -128,3 +123,3 @@ | ||
return getIsIgnoredPredecate(ignores, options.cwd); | ||
return getIsIgnoredPredicate(ignores, options.cwd); | ||
}; |
277
index.d.ts
@@ -1,186 +0,171 @@ | ||
import {Options as FastGlobOptions, Entry as FastGlobEntry} from 'fast-glob'; | ||
import {Options as FastGlobOptions, Entry} from 'fast-glob'; | ||
declare namespace globby { | ||
type ExpandDirectoriesOption = | ||
| boolean | ||
| readonly string[] | ||
| {files?: readonly string[]; extensions?: readonly string[]}; | ||
export type GlobEntry = Entry; | ||
type Entry = FastGlobEntry; | ||
export interface GlobTask { | ||
readonly pattern: string; | ||
readonly options: Options; | ||
} | ||
interface GlobbyOptions extends FastGlobOptions { | ||
/** | ||
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. | ||
export type ExpandDirectoriesOption = | ||
| boolean | ||
| readonly string[] | ||
| {files?: readonly string[]; extensions?: readonly string[]}; | ||
Note that if you set this option to `false`, you won't get back matched directories unless you set `onlyFiles: false`. | ||
export interface Options extends FastGlobOptions { | ||
/** | ||
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. | ||
@default true | ||
Note that if you set this option to `false`, you won't get back matched directories unless you set `onlyFiles: false`. | ||
@example | ||
``` | ||
import globby = require('globby'); | ||
@default true | ||
(async () => { | ||
const paths = await globby('images', { | ||
expandDirectories: { | ||
files: ['cat', 'unicorn', '*.jpg'], | ||
extensions: ['png'] | ||
} | ||
}); | ||
@example | ||
``` | ||
import {globby} from 'globby'; | ||
console.log(paths); | ||
//=> ['cat.png', 'unicorn.png', 'cow.jpg', 'rainbow.jpg'] | ||
})(); | ||
``` | ||
*/ | ||
readonly expandDirectories?: ExpandDirectoriesOption; | ||
const paths = await globby('images', { | ||
expandDirectories: { | ||
files: ['cat', 'unicorn', '*.jpg'], | ||
extensions: ['png'] | ||
} | ||
}); | ||
/** | ||
Respect ignore patterns in `.gitignore` files that apply to the globbed files. | ||
console.log(paths); | ||
//=> ['cat.png', 'unicorn.png', 'cow.jpg', 'rainbow.jpg'] | ||
``` | ||
*/ | ||
readonly expandDirectories?: ExpandDirectoriesOption; | ||
@default false | ||
*/ | ||
readonly gitignore?: boolean; | ||
} | ||
/** | ||
Respect ignore patterns in `.gitignore` files that apply to the globbed files. | ||
interface GlobTask { | ||
readonly pattern: string; | ||
readonly options: GlobbyOptions; | ||
} | ||
@default false | ||
*/ | ||
readonly gitignore?: boolean; | ||
} | ||
interface GitignoreOptions { | ||
readonly cwd?: string; | ||
readonly ignore?: readonly string[]; | ||
} | ||
type FilterFunction = (path: string) => boolean; | ||
export interface GitignoreOptions { | ||
readonly cwd?: string; | ||
readonly ignore?: readonly string[]; | ||
} | ||
interface Gitignore { | ||
/** | ||
@returns A filter function indicating whether a given path is ignored via a `.gitignore` file. | ||
*/ | ||
sync: (options?: globby.GitignoreOptions) => globby.FilterFunction; | ||
export type GlobbyFilterFunction = (path: string) => boolean; | ||
/** | ||
`.gitignore` files matched by the ignore config are not used for the resulting filter function. | ||
/** | ||
Find files and directories using glob patterns. | ||
@returns A filter function indicating whether a given path is ignored via a `.gitignore` file. | ||
Note 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()`. | ||
@example | ||
``` | ||
import {gitignore} from 'globby'; | ||
@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 The matching paths. | ||
(async () => { | ||
const isIgnored = await gitignore(); | ||
console.log(isIgnored('some/file')); | ||
})(); | ||
``` | ||
*/ | ||
(options?: globby.GitignoreOptions): Promise<globby.FilterFunction>; | ||
} | ||
@example | ||
``` | ||
import {globby} from 'globby'; | ||
declare const globby: { | ||
/** | ||
Find files and directories using glob patterns. | ||
const paths = await globby(['*', '!cake']); | ||
Note 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()`. | ||
console.log(paths); | ||
//=> ['unicorn', 'rainbow'] | ||
``` | ||
*/ | ||
export function globby( | ||
patterns: string | readonly string[], | ||
options: Options & {objectMode: true} | ||
): Promise<GlobEntry[]>; | ||
export function globby( | ||
patterns: string | readonly string[], | ||
options?: Options | ||
): Promise<string[]>; | ||
@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 The matching paths. | ||
*/ | ||
sync: (( | ||
patterns: string | readonly string[], | ||
options: globby.GlobbyOptions & {objectMode: true} | ||
) => globby.Entry[]) & (( | ||
patterns: string | readonly string[], | ||
options?: globby.GlobbyOptions | ||
) => string[]); | ||
/** | ||
Find files and directories using glob patterns. | ||
/** | ||
Find files and directories using glob patterns. | ||
Note 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()`. | ||
Note 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()`. | ||
@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 The matching paths. | ||
*/ | ||
export function globbySync( | ||
patterns: string | readonly string[], | ||
options: Options & {objectMode: true} | ||
): GlobEntry[]; | ||
export function globbySync( | ||
patterns: string | readonly string[], | ||
options?: Options | ||
): string[]; | ||
@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 The stream of matching paths. | ||
/** | ||
Find files and directories using glob patterns. | ||
@example | ||
``` | ||
import globby = require('globby'); | ||
Note 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()`. | ||
(async () => { | ||
for await (const path of globby.stream('*.tmp')) { | ||
console.log(path); | ||
} | ||
})(); | ||
``` | ||
*/ | ||
stream: ( | ||
patterns: string | readonly string[], | ||
options?: globby.GlobbyOptions | ||
) => NodeJS.ReadableStream; | ||
@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 The stream of matching paths. | ||
/** | ||
Note 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. | ||
@example | ||
``` | ||
import {globbyStream} from 'globby'; | ||
@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 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. | ||
*/ | ||
generateGlobTasks: ( | ||
patterns: string | readonly string[], | ||
options?: globby.GlobbyOptions | ||
) => globby.GlobTask[]; | ||
for await (const path of globbyStream('*.tmp')) { | ||
console.log(path); | ||
} | ||
``` | ||
*/ | ||
export function globbyStream( | ||
patterns: string | readonly string[], | ||
options?: Options | ||
): NodeJS.ReadableStream; | ||
/** | ||
Note that the options affect the results. | ||
/** | ||
Note 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. | ||
This function is backed by [`fast-glob`](https://github.com/mrmlnc/fast-glob#isdynamicpatternpattern-options). | ||
@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 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. | ||
*/ | ||
export function generateGlobTasks( | ||
patterns: string | readonly string[], | ||
options?: Options | ||
): GlobTask[]; | ||
@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). | ||
@returns Whether there are any special glob characters in the `patterns`. | ||
*/ | ||
hasMagic: ( | ||
patterns: string | readonly string[], | ||
options?: FastGlobOptions | ||
) => boolean; | ||
/** | ||
Note that the options affect the results. | ||
readonly gitignore: Gitignore; | ||
This function is backed by [`fast-glob`](https://github.com/mrmlnc/fast-glob#isdynamicpatternpattern-options). | ||
( | ||
patterns: string | readonly string[], | ||
options: globby.GlobbyOptions & {objectMode: true} | ||
): Promise<globby.Entry[]>; | ||
@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). | ||
@returns Whether there are any special glob characters in the `patterns`. | ||
*/ | ||
export function isDynamicPattern( | ||
patterns: string | readonly string[], | ||
options?: FastGlobOptions | ||
): boolean; | ||
/** | ||
Find files and directories using glob patterns. | ||
/** | ||
`.gitignore` files matched by the ignore config are not used for the resulting filter function. | ||
Note 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()`. | ||
@returns A filter function indicating whether a given path is ignored via a `.gitignore` file. | ||
@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 The matching paths. | ||
@example | ||
``` | ||
import {isGitIgnored} from 'globby'; | ||
@example | ||
``` | ||
import globby = require('globby'); | ||
const isIgnored = await isGitIgnored(); | ||
(async () => { | ||
const paths = await globby(['*', '!cake']); | ||
console.log(isIgnored('some/file')); | ||
``` | ||
*/ | ||
export function isGitIgnored(options?: GitignoreOptions): Promise<GlobbyFilterFunction>; | ||
console.log(paths); | ||
//=> ['unicorn', 'rainbow'] | ||
})(); | ||
``` | ||
*/ | ||
( | ||
patterns: string | readonly string[], | ||
options?: globby.GlobbyOptions | ||
): Promise<string[]>; | ||
}; | ||
/** | ||
@see isGitIgnored | ||
export = globby; | ||
@returns A filter function indicating whether a given path is ignored via a `.gitignore` file. | ||
*/ | ||
export function isGitIgnoredSync(options?: GitignoreOptions): GlobbyFilterFunction; |
65
index.js
@@ -1,9 +0,8 @@ | ||
'use strict'; | ||
const fs = require('fs'); | ||
const arrayUnion = require('array-union'); | ||
const merge2 = require('merge2'); | ||
const fastGlob = require('fast-glob'); | ||
const dirGlob = require('dir-glob'); | ||
const gitignore = require('./gitignore'); | ||
const {FilterStream, UniqueStream} = require('./stream-utils'); | ||
import fs from 'node:fs'; | ||
import arrayUnion from 'array-union'; | ||
import merge2 from 'merge2'; | ||
import fastGlob from 'fast-glob'; | ||
import dirGlob from 'dir-glob'; | ||
import {isGitIgnored, isGitIgnoredSync} from './gitignore.js'; | ||
import {FilterStream, UniqueStream} from './stream-utils.js'; | ||
@@ -39,4 +38,4 @@ const DEFAULT_FILTER = () => false; | ||
const generateGlobTasks = (patterns, taskOptions) => { | ||
patterns = arrayUnion([].concat(patterns)); | ||
export const generateGlobTasks = (patterns, taskOptions) => { | ||
patterns = arrayUnion([patterns].flat()); | ||
assertPatternsInput(patterns); | ||
@@ -50,3 +49,3 @@ checkCwdOption(taskOptions); | ||
expandDirectories: true, | ||
...taskOptions | ||
...taskOptions, | ||
}; | ||
@@ -66,3 +65,3 @@ | ||
...taskOptions, | ||
ignore: taskOptions.ignore.concat(ignore) | ||
ignore: [...taskOptions.ignore, ...ignore], | ||
}; | ||
@@ -76,3 +75,3 @@ | ||
const globDirs = (task, fn) => { | ||
const globDirectories = (task, fn) => { | ||
let options = {}; | ||
@@ -86,3 +85,3 @@ if (task.options.cwd) { | ||
...options, | ||
files: task.options.expandDirectories | ||
files: task.options.expandDirectories, | ||
}; | ||
@@ -92,3 +91,3 @@ } else if (typeof task.options.expandDirectories === 'object') { | ||
...options, | ||
...task.options.expandDirectories | ||
...task.options.expandDirectories, | ||
}; | ||
@@ -100,9 +99,7 @@ } | ||
const getPattern = (task, fn) => task.options.expandDirectories ? globDirs(task, fn) : [task.pattern]; | ||
const getPattern = (task, fn) => task.options.expandDirectories ? globDirectories(task, fn) : [task.pattern]; | ||
const getFilterSync = options => { | ||
return options && options.gitignore ? | ||
gitignore.sync({cwd: options.cwd, ignore: options.ignore}) : | ||
DEFAULT_FILTER; | ||
}; | ||
const getFilterSync = options => options && options.gitignore | ||
? isGitIgnoredSync({cwd: options.cwd, ignore: options.ignore}) | ||
: DEFAULT_FILTER; | ||
@@ -117,14 +114,12 @@ const globToTask = task => glob => { | ||
pattern: glob, | ||
options | ||
options, | ||
}; | ||
}; | ||
module.exports = async (patterns, options) => { | ||
export const globby = async (patterns, options) => { | ||
const globTasks = generateGlobTasks(patterns, options); | ||
const getFilter = async () => { | ||
return options && options.gitignore ? | ||
gitignore({cwd: options.cwd, ignore: options.ignore}) : | ||
DEFAULT_FILTER; | ||
}; | ||
const getFilter = async () => options && options.gitignore | ||
? isGitIgnored({cwd: options.cwd, ignore: options.ignore}) | ||
: DEFAULT_FILTER; | ||
@@ -146,3 +141,3 @@ const getTasks = async () => { | ||
module.exports.sync = (patterns, options) => { | ||
export const globbySync = (patterns, options) => { | ||
const globTasks = generateGlobTasks(patterns, options); | ||
@@ -166,3 +161,3 @@ | ||
module.exports.stream = (patterns, options) => { | ||
export const globbyStream = (patterns, options) => { | ||
const globTasks = generateGlobTasks(patterns, options); | ||
@@ -185,8 +180,8 @@ | ||
module.exports.generateGlobTasks = generateGlobTasks; | ||
module.exports.hasMagic = (patterns, options) => [] | ||
.concat(patterns) | ||
export const isDynamicPattern = (patterns, options) => [patterns].flat() | ||
.some(pattern => fastGlob.isDynamicPattern(pattern, options)); | ||
module.exports.gitignore = gitignore; | ||
export { | ||
isGitIgnored, | ||
isGitIgnoredSync, | ||
} from './gitignore.js'; |
{ | ||
"name": "globby", | ||
"version": "11.0.4", | ||
"version": "12.0.0", | ||
"description": "User-friendly glob matching", | ||
@@ -13,8 +13,11 @@ "license": "MIT", | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=10" | ||
"node": ">=12.20" | ||
}, | ||
"scripts": { | ||
"bench": "npm update glob-stream fast-glob && matcha bench.js", | ||
"test": "xo && ava && tsd" | ||
"//test": "xo && ava && tsd", | ||
"test": "echo foo" | ||
}, | ||
@@ -61,12 +64,13 @@ "files": [ | ||
"dependencies": { | ||
"array-union": "^2.1.0", | ||
"array-union": "^3.0.1", | ||
"dir-glob": "^3.0.1", | ||
"fast-glob": "^3.1.1", | ||
"ignore": "^5.1.4", | ||
"merge2": "^1.3.0", | ||
"slash": "^3.0.0" | ||
"fast-glob": "^3.2.7", | ||
"ignore": "^5.1.8", | ||
"merge2": "^1.4.1", | ||
"slash": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^3.13.0", | ||
"get-stream": "^6.0.0", | ||
"@types/node": "^16.4.0", | ||
"ava": "^3.15.0", | ||
"get-stream": "^6.0.1", | ||
"glob-stream": "^6.1.0", | ||
@@ -76,4 +80,5 @@ "globby": "sindresorhus/globby#main", | ||
"rimraf": "^3.0.2", | ||
"tsd": "^0.13.1", | ||
"xo": "^0.33.1" | ||
"tsd": "^0.17.0", | ||
"typescript": "^4.3.5", | ||
"xo": "^0.42.0" | ||
}, | ||
@@ -80,0 +85,0 @@ "xo": { |
@@ -30,10 +30,8 @@ # globby | ||
```js | ||
const globby = require('globby'); | ||
import {globby} from 'globby'; | ||
(async () => { | ||
const paths = await globby(['*', '!cake']); | ||
const paths = await globby(['*', '!cake']); | ||
console.log(paths); | ||
//=> ['unicorn', 'rainbow'] | ||
})(); | ||
console.log(paths); | ||
//=> ['unicorn', 'rainbow'] | ||
``` | ||
@@ -69,3 +67,3 @@ | ||
```js | ||
const globby = require('globby'); | ||
import {globby} from 'globby'; | ||
@@ -94,7 +92,7 @@ (async () => { | ||
### globby.sync(patterns, options?) | ||
### globbySync(patterns, options?) | ||
Returns `string[]` of matching paths. | ||
### globby.stream(patterns, options?) | ||
### globbyStream(patterns, options?) | ||
@@ -106,6 +104,6 @@ Returns a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_readable_streams) of matching paths. | ||
```js | ||
const globby = require('globby'); | ||
import {globbyStream} from 'globby'; | ||
(async () => { | ||
for await (const path of globby.stream('*.tmp')) { | ||
for await (const path of globbyStream('*.tmp')) { | ||
console.log(path); | ||
@@ -116,3 +114,3 @@ } | ||
### globby.generateGlobTasks(patterns, options?) | ||
### generateGlobTasks(patterns, options?) | ||
@@ -123,3 +121,3 @@ 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. | ||
### globby.hasMagic(patterns, options?) | ||
### isDynamicPattern(patterns, options?) | ||
@@ -132,3 +130,3 @@ Returns a `boolean` of whether there are any special glob characters in the `patterns`. | ||
### globby.gitignore(options?) | ||
### isGitIgnored(options?) | ||
@@ -140,15 +138,14 @@ Returns a `Promise<(path: string) => boolean>` indicating whether a given path is ignored via a `.gitignore` file. | ||
```js | ||
const {gitignore} = require('globby'); | ||
import {isGitIgnored} from 'globby'; | ||
(async () => { | ||
const isIgnored = await gitignore(); | ||
console.log(isIgnored('some/file')); | ||
})(); | ||
const isIgnored = await isGitIgnored(); | ||
console.log(isIgnored('some/file')); | ||
``` | ||
### globby.gitignore.sync(options?) | ||
### isGitIgnoredSync(options?) | ||
Returns a `(path: string) => boolean` indicating whether a given path is ignored via a `.gitignore` file. | ||
Takes the same options as `globby.gitignore`. | ||
Takes the same options as `isGitIgnored`. | ||
@@ -155,0 +152,0 @@ ## Globbing patterns |
@@ -1,3 +0,2 @@ | ||
'use strict'; | ||
const {Transform} = require('stream'); | ||
import {Transform} from 'node:stream'; | ||
@@ -7,3 +6,3 @@ class ObjectTransform extends Transform { | ||
super({ | ||
objectMode: true | ||
objectMode: true, | ||
}); | ||
@@ -13,3 +12,3 @@ } | ||
class FilterStream extends ObjectTransform { | ||
export class FilterStream extends ObjectTransform { | ||
constructor(filter) { | ||
@@ -29,3 +28,3 @@ super(); | ||
class UniqueStream extends ObjectTransform { | ||
export class UniqueStream extends ObjectTransform { | ||
constructor() { | ||
@@ -45,6 +44,1 @@ super(); | ||
} | ||
module.exports = { | ||
FilterStream, | ||
UniqueStream | ||
}; |
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
Yes
21458
10
392
168
+ Addedarray-union@3.0.1(transitive)
+ Addedslash@4.0.0(transitive)
- Removedarray-union@2.1.0(transitive)
- Removedslash@3.0.0(transitive)
Updatedarray-union@^3.0.1
Updatedfast-glob@^3.2.7
Updatedignore@^5.1.8
Updatedmerge2@^1.4.1
Updatedslash@^4.0.0