Socket
Socket
Sign inDemoInstall

fdir

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fdir - npm Package Compare versions

Comparing version 6.0.2 to 6.1.0

4

dist/package.json
{
"name": "fdir",
"version": "6.0.2",
"version": "6.1.0",
"description": "The fastest directory crawler & globbing alternative to glob, fast-glob, & tiny-glob. Crawls 1m files in < 1s",

@@ -13,3 +13,3 @@ "main": "dist/index.js",

"test:watch": "vitest __tests__/",
"bench": "node benchmarks/benchmark.js",
"bench": "ts-node benchmarks/benchmark.js",
"bench:glob": "ts-node benchmarks/glob-benchmark.ts",

@@ -16,0 +16,0 @@ "bench:fdir": "ts-node benchmarks/fdir-benchmark.ts",

@@ -1,4 +0,4 @@

import { Options } from "../../types";
export declare function joinDirectoryPath(filename: string, directoryPath: string): string;
import { Options, PathSeparator } from "../../types";
export declare function joinDirectoryPath(filename: string, directoryPath: string, separator: PathSeparator): string;
export type JoinPathFunction = (filename: string, directoryPath: string) => string;
export declare function build(root: string, options: Options): JoinPathFunction;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.build = exports.joinDirectoryPath = void 0;
const path_1 = require("path");
function joinPathWithBasePath(filename, directoryPath) {
return directoryPath + filename;
}
function joinPathWithRelativePath(relativePath) {
relativePath += relativePath[relativePath.length - 1] === path_1.sep ? "" : path_1.sep;
function joinPathWithRelativePath(root) {
return function (filename, directoryPath) {
return directoryPath.substring(relativePath.length) + filename;
return directoryPath.substring(root.length) + filename;
};

@@ -17,4 +15,4 @@ }

}
function joinDirectoryPath(filename, directoryPath) {
return directoryPath + filename + path_1.sep;
function joinDirectoryPath(filename, directoryPath, separator) {
return directoryPath + filename + separator;
}

@@ -21,0 +19,0 @@ exports.joinDirectoryPath = joinDirectoryPath;

@@ -81,12 +81,13 @@ "use strict";

normalizePath(path) {
const { resolvePaths, normalizePath, pathSeparator } = this.state.options;
const pathNeedsCleaning = (process.platform === "win32" && path.includes("/")) ||
path.startsWith(".");
if (this.state.options.resolvePaths)
if (resolvePaths)
path = (0, path_1.resolve)(path);
if (this.state.options.normalizePath || pathNeedsCleaning)
if (normalizePath || pathNeedsCleaning)
path = (0, utils_1.cleanPath)(path);
if (path === ".")
return "";
const needsSeperator = path[path.length - 1] !== path_1.sep;
return needsSeperator ? path + path_1.sep : path;
const needsSeperator = path[path.length - 1] !== pathSeparator;
return (0, utils_1.convertSlashes)(needsSeperator ? path + pathSeparator : path, pathSeparator);
}

@@ -106,3 +107,3 @@ walk = (entries, directoryPath, depth) => {

else if (entry.isDirectory()) {
let path = joinPath.joinDirectoryPath(entry.name, directoryPath);
let path = joinPath.joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
if (exclude && exclude(entry.name, path))

@@ -113,3 +114,3 @@ continue;

else if (entry.isSymbolicLink() && resolveSymlinks) {
let path = joinPath.joinDirectoryPath(entry.name, directoryPath);
let path = joinPath.joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
this.resolveSymlink(path, this.state, (stat, resolvedPath) => {

@@ -116,0 +117,0 @@ if (stat.isDirectory()) {

@@ -10,2 +10,3 @@ /// <reference types="node" />

group(): Builder<GroupOutput>;
withPathSeparator(separator: "/" | "\\"): this;
withBasePath(): this;

@@ -12,0 +13,0 @@ withRelativePaths(): this;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Builder = void 0;
const path_1 = require("path");
const api_builder_1 = require("./api-builder");

@@ -19,2 +20,3 @@ var pm = null;

suppressErrors: true,
pathSeparator: path_1.sep,
filters: [],

@@ -29,2 +31,6 @@ };

}
withPathSeparator(separator) {
this.options.pathSeparator = separator;
return this;
}
withBasePath() {

@@ -31,0 +37,0 @@ this.options.includeBasePath = true;

@@ -33,2 +33,3 @@ /// <reference types="node" />

export type ExcludePredicate = (dirName: string, dirPath: string) => boolean;
export type PathSeparator = "/" | "\\";
export type Options = {

@@ -49,3 +50,4 @@ includeBasePath?: boolean;

relativePaths?: boolean;
pathSeparator: PathSeparator;
signal?: AbortSignal;
};

@@ -0,1 +1,3 @@

import { PathSeparator } from "./types";
export declare function cleanPath(path: string): string;
export declare function convertSlashes(path: string, separator: PathSeparator): string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cleanPath = void 0;
exports.convertSlashes = exports.cleanPath = void 0;
const path_1 = require("path");
function cleanPath(path) {
let normalized = (0, path_1.normalize)(path);
// to account for / path
// we have to remove the last path separator
// to account for / root path
if (normalized.length > 1 && normalized[normalized.length - 1] === path_1.sep)

@@ -13,1 +14,6 @@ normalized = normalized.substring(0, normalized.length - 1);

exports.cleanPath = cleanPath;
const SLASHES_REGEX = /[\\/]+/g;
function convertSlashes(path, separator) {
return path.replace(SLASHES_REGEX, separator);
}
exports.convertSlashes = convertSlashes;
{
"name": "fdir",
"version": "6.0.2",
"version": "6.1.0",
"description": "The fastest directory crawler & globbing alternative to glob, fast-glob, & tiny-glob. Crawls 1m files in < 1s",

@@ -13,3 +13,3 @@ "main": "dist/index.js",

"test:watch": "vitest __tests__/",
"bench": "node benchmarks/benchmark.js",
"bench": "ts-node benchmarks/benchmark.js",
"bench:glob": "ts-node benchmarks/glob-benchmark.ts",

@@ -16,0 +16,0 @@ "bench:fdir": "ts-node benchmarks/fdir-benchmark.ts",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc