| 463 | return real !== null && pattern.realpaths.has(real); |
| 464 | } |
| 465 | #addSubpattern(path, pattern) { |
| 466 | if (this.#isExcluded(path)) { |
| 467 | return; |
| 468 | } |
| 469 | const fullpath = resolve(this.#root, path); |
| 470 | |
| 471 | // If path is a directory, add trailing slash and test patterns again. |
| 472 | if (this.#isExcluded(`${fullpath}/`) && this.#cache.statSync(fullpath).isDirectory()) { |
| 473 | return; |
| 474 | } |
| 475 | |
| 476 | if (this.#exclude) { |
| 477 | if (this.#withFileTypes) { |
| 478 | const stat = this.#cache.statSync(path); |
| 479 | if (stat !== null) { |
| 480 | if (this.#exclude(stat)) { |
| 481 | return; |
| 482 | } |
| 483 | } |
| 484 | } else if (this.#exclude(path)) { |
| 485 | return; |
| 486 | } |
| 487 | } |
| 488 | if (!this.#subpatterns.has(path)) { |
| 489 | this.#subpatterns.set(path, [pattern]); |
| 490 | } else { |
| 491 | ArrayPrototypePush(this.#subpatterns.get(path), pattern); |
| 492 | } |
| 493 | } |
| 494 | #addSubpatterns(path, pattern) { |
| 495 | const seen = this.#cache.add(path, pattern); |
| 496 | if (seen) { |