diff --git a/ignore.js b/ignore.js index 73c9a52..3d8e1a8 100644 --- a/ignore.js +++ b/ignore.js @@ -59,12 +59,13 @@ const getIsIgnoredPredicate = (files, cwd) => { const normalizeOptions = (options = {}) => ({ cwd: toPath(options.cwd) || process.cwd(), suppressErrors: Boolean(options.suppressErrors), + deep: typeof options.deep === 'number' ? options.deep : Number.POSITIVE_INFINITY, }); export const isIgnoredByIgnoreFiles = async (patterns, options) => { - const {cwd, suppressErrors} = normalizeOptions(options); + const {cwd, suppressErrors, deep} = normalizeOptions(options); - const paths = await fastGlob(patterns, {cwd, suppressErrors, ...ignoreFilesGlobOptions}); + const paths = await fastGlob(patterns, {cwd, suppressErrors, deep, ...ignoreFilesGlobOptions}); const files = await Promise.all( paths.map(async filePath => ({ @@ -77,9 +78,9 @@ export const isIgnoredByIgnoreFiles = async (patterns, options) => { }; export const isIgnoredByIgnoreFilesSync = (patterns, options) => { - const {cwd, suppressErrors} = normalizeOptions(options); + const {cwd, suppressErrors, deep} = normalizeOptions(options); - const paths = fastGlob.sync(patterns, {cwd, suppressErrors, ...ignoreFilesGlobOptions}); + const paths = fastGlob.sync(patterns, {cwd, suppressErrors, deep, ...ignoreFilesGlobOptions}); const files = paths.map(filePath => ({ filePath,