pnpm 11.5.0 → 11.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,10 +26,11 @@ let path = require("path");
26
26
  let url = require("url");
27
27
  let fdir = require("fdir");
28
28
  let picomatch = require("picomatch");
29
- picomatch = __toESM(picomatch);
29
+ picomatch = __toESM(picomatch, 1);
30
30
  //#region src/utils.ts
31
31
  const isReadonlyArray = Array.isArray;
32
32
  const BACKSLASHES = /\\/g;
33
+ const DRIVE_RELATIVE_PATH = /^[A-Za-z]:$/;
33
34
  const isWin = process.platform === "win32";
34
35
  const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
35
36
  function getPartialMatcher(patterns, options = {}) {
@@ -96,18 +97,21 @@ function buildRelative(cwd, root) {
96
97
  return p[p.length - 1] === "/" && result !== "" ? `${result}/` : result || ".";
97
98
  };
98
99
  }
100
+ function ensureNonDriveRelativePath(path$1) {
101
+ return path$1.replace(DRIVE_RELATIVE_PATH, (match) => `${match}/`);
102
+ }
99
103
  const splitPatternOptions = { parts: true };
100
- function splitPattern(path$1) {
104
+ function splitPattern(path$2) {
101
105
  var _result$parts;
102
- const result = picomatch.default.scan(path$1, splitPatternOptions);
103
- return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1];
106
+ const result = picomatch.default.scan(path$2, splitPatternOptions);
107
+ return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$2];
104
108
  }
105
109
  const ESCAPED_WIN32_BACKSLASHES = /\\(?![()[\]{}!+@])/g;
106
- function convertPosixPathToPattern(path$2) {
107
- return escapePosixPath(path$2);
110
+ function convertPosixPathToPattern(path$3) {
111
+ return escapePosixPath(path$3);
108
112
  }
109
- function convertWin32PathToPattern(path$3) {
110
- return escapeWin32Path(path$3).replace(ESCAPED_WIN32_BACKSLASHES, "/");
113
+ function convertWin32PathToPattern(path$4) {
114
+ return escapeWin32Path(path$4).replace(ESCAPED_WIN32_BACKSLASHES, "/");
111
115
  }
112
116
  /**
113
117
  * Converts a path to a pattern depending on the platform.
@@ -118,8 +122,8 @@ function convertWin32PathToPattern(path$3) {
118
122
  const convertPathToPattern = isWin ? convertWin32PathToPattern : convertPosixPathToPattern;
119
123
  const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
120
124
  const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
121
- const escapePosixPath = (path$4) => path$4.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
122
- const escapeWin32Path = (path$5) => path$5.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
125
+ const escapePosixPath = (path$5) => path$5.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
126
+ const escapeWin32Path = (path$6) => path$6.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
123
127
  /**
124
128
  * Escapes a path's special characters depending on the platform.
125
129
  * @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
@@ -173,7 +177,7 @@ function normalizePattern(pattern, opts, props, isIgnore) {
173
177
  }
174
178
  const potentialRoot = path.posix.join(cwd, parentDir.slice(i * 3));
175
179
  if (potentialRoot[0] !== "." && props.root.length > potentialRoot.length) {
176
- props.root = potentialRoot;
180
+ props.root = ensureNonDriveRelativePath(potentialRoot);
177
181
  props.depthOffset = -n + i;
178
182
  }
179
183
  }
@@ -193,7 +197,7 @@ function normalizePattern(pattern, opts, props, isIgnore) {
193
197
  }
194
198
  props.depthOffset = newCommonPath.length;
195
199
  props.commonPath = newCommonPath;
196
- props.root = newCommonPath.length > 0 ? path.posix.join(cwd, ...newCommonPath) : cwd;
200
+ props.root = ensureNonDriveRelativePath(newCommonPath.length > 0 ? path.posix.join(cwd, ...newCommonPath) : cwd);
197
201
  }
198
202
  return result;
199
203
  }
@@ -286,18 +290,15 @@ function formatPaths(paths, mapper) {
286
290
  }
287
291
  const defaultOptions = {
288
292
  caseSensitiveMatch: true,
289
- cwd: process.cwd(),
290
293
  debug: !!process.env.TINYGLOBBY_DEBUG,
291
294
  expandDirectories: true,
292
295
  followSymbolicLinks: true,
293
296
  onlyFiles: true
294
297
  };
295
298
  function getOptions(options) {
296
- const opts = {
297
- ...defaultOptions,
298
- ...options
299
- };
300
- opts.cwd = (opts.cwd instanceof URL ? (0, url.fileURLToPath)(opts.cwd) : (0, path.resolve)(opts.cwd)).replace(BACKSLASHES, "/");
299
+ const opts = Object.assign({}, options);
300
+ for (const key in defaultOptions) if (opts[key] === void 0) Object.assign(opts, { [key]: defaultOptions[key] });
301
+ opts.cwd = (opts.cwd instanceof URL ? (0, url.fileURLToPath)(opts.cwd) : (0, path.resolve)(opts.cwd || process.cwd())).replace(BACKSLASHES, "/");
301
302
  opts.ignore = ensureStringArray(opts.ignore);
302
303
  opts.fs && (opts.fs = {
303
304
  readdir: opts.fs.readdir || fs.readdir,
@@ -145,4 +145,4 @@ declare function globSync(patterns: string | readonly string[], options?: Omit<G
145
145
  */
146
146
  declare function globSync(options: GlobOptions): string[];
147
147
  //#endregion
148
- export { type GlobOptions, convertPathToPattern, escapePath, glob, globSync, isDynamicPattern };
148
+ export { type FileSystemAdapter, type GlobOptions, convertPathToPattern, escapePath, glob, globSync, isDynamicPattern };
@@ -145,4 +145,4 @@ declare function globSync(patterns: string | readonly string[], options?: Omit<G
145
145
  */
146
146
  declare function globSync(options: GlobOptions): string[];
147
147
  //#endregion
148
- export { type GlobOptions, convertPathToPattern, escapePath, glob, globSync, isDynamicPattern };
148
+ export { type FileSystemAdapter, type GlobOptions, convertPathToPattern, escapePath, glob, globSync, isDynamicPattern };
@@ -6,6 +6,7 @@ import picomatch from "picomatch";
6
6
  //#region src/utils.ts
7
7
  const isReadonlyArray = Array.isArray;
8
8
  const BACKSLASHES = /\\/g;
9
+ const DRIVE_RELATIVE_PATH = /^[A-Za-z]:$/;
9
10
  const isWin = process.platform === "win32";
10
11
  const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
11
12
  function getPartialMatcher(patterns, options = {}) {
@@ -72,6 +73,9 @@ function buildRelative(cwd, root) {
72
73
  return p[p.length - 1] === "/" && result !== "" ? `${result}/` : result || ".";
73
74
  };
74
75
  }
76
+ function ensureNonDriveRelativePath(path) {
77
+ return path.replace(DRIVE_RELATIVE_PATH, (match) => `${match}/`);
78
+ }
75
79
  const splitPatternOptions = { parts: true };
76
80
  function splitPattern(path) {
77
81
  var _result$parts;
@@ -149,7 +153,7 @@ function normalizePattern(pattern, opts, props, isIgnore) {
149
153
  }
150
154
  const potentialRoot = posix.join(cwd, parentDir.slice(i * 3));
151
155
  if (potentialRoot[0] !== "." && props.root.length > potentialRoot.length) {
152
- props.root = potentialRoot;
156
+ props.root = ensureNonDriveRelativePath(potentialRoot);
153
157
  props.depthOffset = -n + i;
154
158
  }
155
159
  }
@@ -169,7 +173,7 @@ function normalizePattern(pattern, opts, props, isIgnore) {
169
173
  }
170
174
  props.depthOffset = newCommonPath.length;
171
175
  props.commonPath = newCommonPath;
172
- props.root = newCommonPath.length > 0 ? posix.join(cwd, ...newCommonPath) : cwd;
176
+ props.root = ensureNonDriveRelativePath(newCommonPath.length > 0 ? posix.join(cwd, ...newCommonPath) : cwd);
173
177
  }
174
178
  return result;
175
179
  }
@@ -262,18 +266,15 @@ function formatPaths(paths, mapper) {
262
266
  }
263
267
  const defaultOptions = {
264
268
  caseSensitiveMatch: true,
265
- cwd: process.cwd(),
266
269
  debug: !!process.env.TINYGLOBBY_DEBUG,
267
270
  expandDirectories: true,
268
271
  followSymbolicLinks: true,
269
272
  onlyFiles: true
270
273
  };
271
274
  function getOptions(options) {
272
- const opts = {
273
- ...defaultOptions,
274
- ...options
275
- };
276
- opts.cwd = (opts.cwd instanceof URL ? fileURLToPath(opts.cwd) : resolve(opts.cwd)).replace(BACKSLASHES, "/");
275
+ const opts = Object.assign({}, options);
276
+ for (const key in defaultOptions) if (opts[key] === void 0) Object.assign(opts, { [key]: defaultOptions[key] });
277
+ opts.cwd = (opts.cwd instanceof URL ? fileURLToPath(opts.cwd) : resolve(opts.cwd || process.cwd())).replace(BACKSLASHES, "/");
277
278
  opts.ignore = ensureStringArray(opts.ignore);
278
279
  opts.fs && (opts.fs = {
279
280
  readdir: opts.fs.readdir || readdir,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinyglobby",
3
- "version": "0.2.16",
3
+ "version": "0.2.17",
4
4
  "description": "A fast and minimal alternative to globby and fast-glob",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -22,8 +22,8 @@
22
22
  "keywords": [
23
23
  "glob",
24
24
  "patterns",
25
- "fast",
26
- "implementation"
25
+ "tiny",
26
+ "fast"
27
27
  ],
28
28
  "repository": {
29
29
  "type": "git",
@@ -41,22 +41,19 @@
41
41
  "picomatch": "^4.0.4"
42
42
  },
43
43
  "devDependencies": {
44
- "@biomejs/biome": "^2.4.10",
45
- "@types/node": "^25.5.2",
44
+ "@biomejs/biome": "^2.4.16",
45
+ "@types/node": "^25.9.1",
46
46
  "@types/picomatch": "^4.0.3",
47
47
  "fast-glob": "^3.3.3",
48
- "fs-fixture": "^2.13.0",
48
+ "fs-fixture": "^2.14.0",
49
49
  "glob": "^13.0.6",
50
- "tinybench": "^6.0.0",
51
- "tsdown": "^0.21.7",
52
- "typescript": "^6.0.2"
50
+ "tinybench": "^6.0.2",
51
+ "tsdown": "^0.22.1",
52
+ "typescript": "^6.0.3"
53
53
  },
54
54
  "engines": {
55
55
  "node": ">=12.0.0"
56
56
  },
57
- "publishConfig": {
58
- "provenance": true
59
- },
60
57
  "scripts": {
61
58
  "bench": "node benchmark/bench.ts",
62
59
  "bench:setup": "node benchmark/setup.ts",