Skip to content

Commit

Permalink
deps: ignore-walk@6.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Dec 6, 2023
1 parent 35371c8 commit 937b7b7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
34 changes: 25 additions & 9 deletions node_modules/ignore-walk/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Walker extends EE {
this.result = this.parent ? this.parent.result : new Set()
this.entries = null
this.sawError = false
this.exact = opts.exact
}

sort (a, b) {
Expand Down Expand Up @@ -164,7 +165,7 @@ class Walker extends EE {
} else {
// is a directory
if (dir) {
this.walker(entry, { isSymbolicLink }, then)
this.walker(entry, { isSymbolicLink, exact: file || this.filterEntry(entry + '/') }, then)
} else {
then()
}
Expand Down Expand Up @@ -208,15 +209,19 @@ class Walker extends EE {
new Walker(this.walkerOpt(entry, opts)).on('done', then).start()
}

filterEntry (entry, partial) {
filterEntry (entry, partial, entryBasename) {
let included = true

// this = /a/b/c
// entry = d
// parent /a/b sees c/d
if (this.parent && this.parent.filterEntry) {
var pt = this.basename + '/' + entry
included = this.parent.filterEntry(pt, partial)
const parentEntry = this.basename + '/' + entry
const parentBasename = entryBasename || entry
included = this.parent.filterEntry(parentEntry, partial, parentBasename)
if (!included && !this.exact) {
return false
}
}

this.ignoreFiles.forEach(f => {
Expand All @@ -226,17 +231,28 @@ class Walker extends EE {
// so if it's negated, and already included, no need to check
// likewise if it's neither negated nor included
if (rule.negate !== included) {
const isRelativeRule = entryBasename && rule.globParts.some(part =>
part.length <= (part.slice(-1)[0] ? 1 : 2)
)

// first, match against /foo/bar
// then, against foo/bar
// then, in the case of partials, match with a /
// then, if also the rule is relative, match against basename
const match = rule.match('/' + entry) ||
rule.match(entry) ||
(!!partial && (
!!partial && (
rule.match('/' + entry + '/') ||
rule.match(entry + '/'))) ||
(!!partial && rule.negate && (
rule.match('/' + entry, true) ||
rule.match(entry, true)))
rule.match(entry + '/') ||
rule.negate && (
rule.match('/' + entry, true) ||
rule.match(entry, true)) ||
isRelativeRule && (
rule.match('/' + entryBasename + '/') ||
rule.match(entryBasename + '/') ||
rule.negate && (
rule.match('/' + entryBasename, true) ||
rule.match(entryBasename, true))))

if (match) {
included = rule.negate
Expand Down
6 changes: 3 additions & 3 deletions node_modules/ignore-walk/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "ignore-walk",
"version": "6.0.3",
"version": "6.0.4",
"description": "Nested/recursive `.gitignore`/`.npmignore` parsing and filtering.",
"main": "lib/index.js",
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.14.1",
"@npmcli/template-oss": "4.19.0",
"mutate-fs": "^2.1.1",
"tap": "^16.0.1"
},
Expand Down Expand Up @@ -56,7 +56,7 @@
},
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.14.1",
"version": "4.19.0",
"content": "scripts/template-oss",
"publish": "true"
}
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -7998,9 +7998,9 @@
}
},
"node_modules/ignore-walk": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-6.0.3.tgz",
"integrity": "sha512-C7FfFoTA+bI10qfeydT8aZbvr91vAEU+2W5BZUlzPec47oNb07SsOfwYrtxuvOYdUApPP/Qlh4DtAO51Ekk2QA==",
"version": "6.0.4",
"resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-6.0.4.tgz",
"integrity": "sha512-t7sv42WkwFkyKbivUCglsQW5YWMskWtbEf4MNKX5u/CCWHKSPzN4FtBQGsQZgCLbxOzpVlcbWVK5KB3auIOjSw==",
"inBundle": true,
"dependencies": {
"minimatch": "^9.0.0"
Expand Down

0 comments on commit 937b7b7

Please sign in to comment.