Skip to content

Commit 937b7b7

Browse files
committedDec 6, 2023
deps: ignore-walk@6.0.4
1 parent 35371c8 commit 937b7b7

File tree

3 files changed

+31
-15
lines changed

3 files changed

+31
-15
lines changed
 

‎node_modules/ignore-walk/lib/index.js

+25-9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class Walker extends EE {
2222
this.result = this.parent ? this.parent.result : new Set()
2323
this.entries = null
2424
this.sawError = false
25+
this.exact = opts.exact
2526
}
2627

2728
sort (a, b) {
@@ -164,7 +165,7 @@ class Walker extends EE {
164165
} else {
165166
// is a directory
166167
if (dir) {
167-
this.walker(entry, { isSymbolicLink }, then)
168+
this.walker(entry, { isSymbolicLink, exact: file || this.filterEntry(entry + '/') }, then)
168169
} else {
169170
then()
170171
}
@@ -208,15 +209,19 @@ class Walker extends EE {
208209
new Walker(this.walkerOpt(entry, opts)).on('done', then).start()
209210
}
210211

211-
filterEntry (entry, partial) {
212+
filterEntry (entry, partial, entryBasename) {
212213
let included = true
213214

214215
// this = /a/b/c
215216
// entry = d
216217
// parent /a/b sees c/d
217218
if (this.parent && this.parent.filterEntry) {
218-
var pt = this.basename + '/' + entry
219-
included = this.parent.filterEntry(pt, partial)
219+
const parentEntry = this.basename + '/' + entry
220+
const parentBasename = entryBasename || entry
221+
included = this.parent.filterEntry(parentEntry, partial, parentBasename)
222+
if (!included && !this.exact) {
223+
return false
224+
}
220225
}
221226

222227
this.ignoreFiles.forEach(f => {
@@ -226,17 +231,28 @@ class Walker extends EE {
226231
// so if it's negated, and already included, no need to check
227232
// likewise if it's neither negated nor included
228233
if (rule.negate !== included) {
234+
const isRelativeRule = entryBasename && rule.globParts.some(part =>
235+
part.length <= (part.slice(-1)[0] ? 1 : 2)
236+
)
237+
229238
// first, match against /foo/bar
230239
// then, against foo/bar
231240
// then, in the case of partials, match with a /
241+
// then, if also the rule is relative, match against basename
232242
const match = rule.match('/' + entry) ||
233243
rule.match(entry) ||
234-
(!!partial && (
244+
!!partial && (
235245
rule.match('/' + entry + '/') ||
236-
rule.match(entry + '/'))) ||
237-
(!!partial && rule.negate && (
238-
rule.match('/' + entry, true) ||
239-
rule.match(entry, true)))
246+
rule.match(entry + '/') ||
247+
rule.negate && (
248+
rule.match('/' + entry, true) ||
249+
rule.match(entry, true)) ||
250+
isRelativeRule && (
251+
rule.match('/' + entryBasename + '/') ||
252+
rule.match(entryBasename + '/') ||
253+
rule.negate && (
254+
rule.match('/' + entryBasename, true) ||
255+
rule.match(entryBasename, true))))
240256

241257
if (match) {
242258
included = rule.negate

‎node_modules/ignore-walk/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "ignore-walk",
3-
"version": "6.0.3",
3+
"version": "6.0.4",
44
"description": "Nested/recursive `.gitignore`/`.npmignore` parsing and filtering.",
55
"main": "lib/index.js",
66
"devDependencies": {
77
"@npmcli/eslint-config": "^4.0.0",
8-
"@npmcli/template-oss": "4.14.1",
8+
"@npmcli/template-oss": "4.19.0",
99
"mutate-fs": "^2.1.1",
1010
"tap": "^16.0.1"
1111
},
@@ -56,7 +56,7 @@
5656
},
5757
"templateOSS": {
5858
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
59-
"version": "4.14.1",
59+
"version": "4.19.0",
6060
"content": "scripts/template-oss",
6161
"publish": "true"
6262
}

‎package-lock.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -7998,9 +7998,9 @@
79987998
}
79997999
},
80008000
"node_modules/ignore-walk": {
8001-
"version": "6.0.3",
8002-
"resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-6.0.3.tgz",
8003-
"integrity": "sha512-C7FfFoTA+bI10qfeydT8aZbvr91vAEU+2W5BZUlzPec47oNb07SsOfwYrtxuvOYdUApPP/Qlh4DtAO51Ekk2QA==",
8001+
"version": "6.0.4",
8002+
"resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-6.0.4.tgz",
8003+
"integrity": "sha512-t7sv42WkwFkyKbivUCglsQW5YWMskWtbEf4MNKX5u/CCWHKSPzN4FtBQGsQZgCLbxOzpVlcbWVK5KB3auIOjSw==",
80048004
"inBundle": true,
80058005
"dependencies": {
80068006
"minimatch": "^9.0.0"

0 commit comments

Comments
 (0)
Please sign in to comment.