This commit is contained in:
2025-05-12 14:25:25 +02:00
parent ab2db755ef
commit 9e378ca2b7
2719 changed files with 46505 additions and 60181 deletions

View File

@@ -53,7 +53,7 @@ class Walker {
this.callbackInvoker = invokeCallback.build(options, this.isSynchronous);
this.root = (0, utils_1.normalizePath)(root, options);
this.state = {
root: this.root.slice(0, -1),
root: (0, utils_1.isRootDirectory)(this.root) ? this.root : this.root.slice(0, -1),
// Perf: we explicitly tell the compiler to optimize for String arrays
paths: [""].slice(0, 0),
groups: [],
@@ -104,7 +104,8 @@ class Walker {
this.resolveSymlink(path, this.state, (stat, resolvedPath) => {
if (stat.isDirectory()) {
resolvedPath = (0, utils_1.normalizePath)(resolvedPath, this.state.options);
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path + pathSeparator))
if (exclude &&
exclude(entry.name, useRealPaths ? resolvedPath : path + pathSeparator))
return;
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth - 1, this.walk);
}

View File

@@ -122,7 +122,7 @@ class Builder {
const globFn = (this.globFunction || pm);
/* c8 ignore next 5 */
if (!globFn) {
throw new Error('Please specify a glob function to use glob matching.');
throw new Error("Please specify a glob function to use glob matching.");
}
var isMatch = this.globCache[patterns.join("\0")];
if (!isMatch) {

1
node_modules/fdir/dist/utils.d.ts generated vendored
View File

@@ -1,6 +1,7 @@
import { PathSeparator } from "./types";
export declare function cleanPath(path: string): string;
export declare function convertSlashes(path: string, separator: PathSeparator): string;
export declare function isRootDirectory(path: string): boolean;
export declare function normalizePath(path: string, options: {
resolvePaths?: boolean;
normalizePath?: boolean;

6
node_modules/fdir/dist/utils.js generated vendored
View File

@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.normalizePath = exports.convertSlashes = exports.cleanPath = void 0;
exports.normalizePath = exports.isRootDirectory = exports.convertSlashes = exports.cleanPath = void 0;
const path_1 = require("path");
function cleanPath(path) {
let normalized = (0, path_1.normalize)(path);
@@ -16,6 +16,10 @@ function convertSlashes(path, separator) {
return path.replace(SLASHES_REGEX, separator);
}
exports.convertSlashes = convertSlashes;
function isRootDirectory(path) {
return path === "/" || /^[a-z]:\\$/i.test(path);
}
exports.isRootDirectory = isRootDirectory;
function normalizePath(path, options) {
const { resolvePaths, normalizePath, pathSeparator } = options;
const pathNeedsCleaning = (process.platform === "win32" && path.includes("/")) ||

4
node_modules/fdir/package.json generated vendored
View File

@@ -1,12 +1,13 @@
{
"name": "fdir",
"version": "6.4.3",
"version": "6.4.4",
"description": "The fastest directory crawler & globbing alternative to glob, fast-glob, & tiny-glob. Crawls 1m files in < 1s",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"prepublishOnly": "npm run test && npm run build",
"build": "tsc",
"format": "prettier --write src __tests__ benchmarks",
"test": "vitest run __tests__/",
"test:coverage": "vitest run --coverage __tests__/",
"test:watch": "vitest __tests__/",
@@ -65,6 +66,7 @@
"klaw-sync": "^6.0.0",
"mock-fs": "^5.2.0",
"picomatch": "^4.0.2",
"prettier": "^3.5.3",
"recur-readdir": "0.0.1",
"recursive-files": "^1.0.2",
"recursive-fs": "^2.1.0",