@pnpm/exe 11.0.0-rc.0 → 11.0.0-rc.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.
- package/dist/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js +10 -0
- package/dist/node_modules/lru-cache/dist/commonjs/index.js +227 -130
- package/dist/node_modules/lru-cache/dist/commonjs/index.min.js +1 -1
- package/dist/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +4 -0
- package/dist/node_modules/lru-cache/dist/esm/browser/index.js +1688 -0
- package/dist/node_modules/lru-cache/dist/esm/browser/index.min.js +2 -0
- package/dist/node_modules/lru-cache/dist/esm/diagnostics-channel.js +19 -0
- package/dist/node_modules/lru-cache/dist/esm/index.js +227 -130
- package/dist/node_modules/lru-cache/dist/esm/index.min.js +1 -1
- package/dist/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js +7 -0
- package/dist/node_modules/lru-cache/dist/esm/node/index.js +1688 -0
- package/dist/node_modules/lru-cache/dist/esm/node/index.min.js +2 -0
- package/dist/node_modules/lru-cache/package.json +42 -9
- package/dist/node_modules/minimatch/dist/commonjs/ast.js +9 -10
- package/dist/node_modules/minimatch/dist/commonjs/index.js +26 -20
- package/dist/node_modules/minimatch/dist/commonjs/unescape.js +6 -6
- package/dist/node_modules/minimatch/dist/esm/ast.js +9 -10
- package/dist/node_modules/minimatch/dist/esm/index.js +26 -20
- package/dist/node_modules/minimatch/dist/esm/unescape.js +6 -6
- package/dist/node_modules/minimatch/package.json +14 -8
- package/dist/node_modules/minipass-flush/package.json +6 -3
- package/dist/node_modules/tinyglobby/dist/index.cjs +132 -148
- package/dist/node_modules/tinyglobby/dist/index.d.cts +33 -32
- package/dist/node_modules/tinyglobby/dist/index.d.mts +33 -32
- package/dist/node_modules/tinyglobby/dist/index.mjs +134 -146
- package/dist/node_modules/tinyglobby/package.json +10 -10
- package/dist/pnpm.mjs +10126 -8751
- package/package.json +9 -9
- package/dist/node_modules/minipass-flush/LICENSE +0 -15
|
@@ -1,41 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { readdir, readdirSync, realpath, realpathSync, stat, statSync } from "fs";
|
|
2
|
+
import { isAbsolute, posix, resolve } from "path";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
import { fdir } from "fdir";
|
|
5
5
|
import picomatch from "picomatch";
|
|
6
|
-
|
|
7
6
|
//#region src/utils.ts
|
|
8
7
|
const isReadonlyArray = Array.isArray;
|
|
8
|
+
const BACKSLASHES = /\\/g;
|
|
9
9
|
const isWin = process.platform === "win32";
|
|
10
10
|
const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
11
11
|
function getPartialMatcher(patterns, options = {}) {
|
|
12
12
|
const patternsCount = patterns.length;
|
|
13
13
|
const patternsParts = Array(patternsCount);
|
|
14
14
|
const matchers = Array(patternsCount);
|
|
15
|
-
|
|
16
|
-
for (
|
|
15
|
+
let i, j;
|
|
16
|
+
for (i = 0; i < patternsCount; i++) {
|
|
17
17
|
const parts = splitPattern(patterns[i]);
|
|
18
18
|
patternsParts[i] = parts;
|
|
19
19
|
const partsCount = parts.length;
|
|
20
20
|
const partMatchers = Array(partsCount);
|
|
21
|
-
for (
|
|
21
|
+
for (j = 0; j < partsCount; j++) partMatchers[j] = picomatch(parts[j], options);
|
|
22
22
|
matchers[i] = partMatchers;
|
|
23
23
|
}
|
|
24
24
|
return (input) => {
|
|
25
25
|
const inputParts = input.split("/");
|
|
26
26
|
if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
|
|
27
|
-
for (
|
|
27
|
+
for (i = 0; i < patternsCount; i++) {
|
|
28
28
|
const patternParts = patternsParts[i];
|
|
29
29
|
const matcher = matchers[i];
|
|
30
30
|
const inputPatternCount = inputParts.length;
|
|
31
31
|
const minParts = Math.min(inputPatternCount, patternParts.length);
|
|
32
|
-
|
|
32
|
+
j = 0;
|
|
33
33
|
while (j < minParts) {
|
|
34
34
|
const part = patternParts[j];
|
|
35
35
|
if (part.includes("/")) return true;
|
|
36
|
-
|
|
37
|
-
if (!
|
|
38
|
-
if (globstarEnabled && part === "**") return true;
|
|
36
|
+
if (!matcher[j](inputParts[j])) break;
|
|
37
|
+
if (!options.noglobstar && part === "**") return true;
|
|
39
38
|
j++;
|
|
40
39
|
}
|
|
41
40
|
if (j === inputPatternCount) return true;
|
|
@@ -49,7 +48,7 @@ const isRoot = isWin ? (p) => WIN32_ROOT_DIR.test(p) : (p) => p === "/";
|
|
|
49
48
|
function buildFormat(cwd, root, absolute) {
|
|
50
49
|
if (cwd === root || root.startsWith(`${cwd}/`)) {
|
|
51
50
|
if (absolute) {
|
|
52
|
-
const start =
|
|
51
|
+
const start = cwd.length + +!isRoot(cwd);
|
|
53
52
|
return (p, isDir) => p.slice(start, isDir ? -1 : void 0) || ".";
|
|
54
53
|
}
|
|
55
54
|
const prefix = root.slice(cwd.length + 1);
|
|
@@ -70,22 +69,21 @@ function buildRelative(cwd, root) {
|
|
|
70
69
|
}
|
|
71
70
|
return (p) => {
|
|
72
71
|
const result = posix.relative(cwd, `${root}/${p}`);
|
|
73
|
-
|
|
74
|
-
return result || ".";
|
|
72
|
+
return p[p.length - 1] === "/" && result !== "" ? `${result}/` : result || ".";
|
|
75
73
|
};
|
|
76
74
|
}
|
|
77
75
|
const splitPatternOptions = { parts: true };
|
|
78
|
-
function splitPattern(path
|
|
76
|
+
function splitPattern(path) {
|
|
79
77
|
var _result$parts;
|
|
80
|
-
const result = picomatch.scan(path
|
|
81
|
-
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path
|
|
78
|
+
const result = picomatch.scan(path, splitPatternOptions);
|
|
79
|
+
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path];
|
|
82
80
|
}
|
|
83
81
|
const ESCAPED_WIN32_BACKSLASHES = /\\(?![()[\]{}!+@])/g;
|
|
84
|
-
function convertPosixPathToPattern(path
|
|
85
|
-
return escapePosixPath(path
|
|
82
|
+
function convertPosixPathToPattern(path) {
|
|
83
|
+
return escapePosixPath(path);
|
|
86
84
|
}
|
|
87
|
-
function convertWin32PathToPattern(path
|
|
88
|
-
return escapeWin32Path(path
|
|
85
|
+
function convertWin32PathToPattern(path) {
|
|
86
|
+
return escapeWin32Path(path).replace(ESCAPED_WIN32_BACKSLASHES, "/");
|
|
89
87
|
}
|
|
90
88
|
/**
|
|
91
89
|
* Converts a path to a pattern depending on the platform.
|
|
@@ -96,8 +94,8 @@ function convertWin32PathToPattern(path$1) {
|
|
|
96
94
|
const convertPathToPattern = isWin ? convertWin32PathToPattern : convertPosixPathToPattern;
|
|
97
95
|
const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
|
|
98
96
|
const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
99
|
-
const escapePosixPath = (path
|
|
100
|
-
const escapeWin32Path = (path
|
|
97
|
+
const escapePosixPath = (path) => path.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
98
|
+
const escapeWin32Path = (path) => path.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
101
99
|
/**
|
|
102
100
|
* Escapes a path's special characters depending on the platform.
|
|
103
101
|
* @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
|
|
@@ -124,31 +122,33 @@ function isDynamicPattern(pattern, options) {
|
|
|
124
122
|
function log(...tasks) {
|
|
125
123
|
console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
|
|
126
124
|
}
|
|
127
|
-
|
|
125
|
+
function ensureStringArray(value) {
|
|
126
|
+
return typeof value === "string" ? [value] : value !== null && value !== void 0 ? value : [];
|
|
127
|
+
}
|
|
128
128
|
//#endregion
|
|
129
|
-
//#region src/
|
|
129
|
+
//#region src/patterns.ts
|
|
130
130
|
const PARENT_DIRECTORY = /^(\/?\.\.)+/;
|
|
131
131
|
const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
function normalizePattern(pattern, opts, props, isIgnore) {
|
|
133
|
+
var _PARENT_DIRECTORY$exe;
|
|
134
|
+
const cwd = opts.cwd;
|
|
134
135
|
let result = pattern;
|
|
135
|
-
if (pattern.
|
|
136
|
-
if (
|
|
136
|
+
if (pattern[pattern.length - 1] === "/") result = pattern.slice(0, -1);
|
|
137
|
+
if (result[result.length - 1] !== "*" && opts.expandDirectories) result += "/**";
|
|
137
138
|
const escapedCwd = escapePath(cwd);
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
|
|
139
|
+
result = isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")) ? posix.relative(escapedCwd, result) : posix.normalize(result);
|
|
140
|
+
const parentDir = (_PARENT_DIRECTORY$exe = PARENT_DIRECTORY.exec(result)) === null || _PARENT_DIRECTORY$exe === void 0 ? void 0 : _PARENT_DIRECTORY$exe[0];
|
|
141
141
|
const parts = splitPattern(result);
|
|
142
|
-
if (
|
|
143
|
-
const n = (
|
|
142
|
+
if (parentDir) {
|
|
143
|
+
const n = (parentDir.length + 1) / 3;
|
|
144
144
|
let i = 0;
|
|
145
145
|
const cwdParts = escapedCwd.split("/");
|
|
146
146
|
while (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {
|
|
147
147
|
result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
|
|
148
148
|
i++;
|
|
149
149
|
}
|
|
150
|
-
const potentialRoot = posix.join(cwd,
|
|
151
|
-
if (
|
|
150
|
+
const potentialRoot = posix.join(cwd, parentDir.slice(i * 3));
|
|
151
|
+
if (potentialRoot[0] !== "." && props.root.length > potentialRoot.length) {
|
|
152
152
|
props.root = potentialRoot;
|
|
153
153
|
props.depthOffset = -n + i;
|
|
154
154
|
}
|
|
@@ -164,7 +164,7 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
|
|
|
164
164
|
newCommonPath.pop();
|
|
165
165
|
break;
|
|
166
166
|
}
|
|
167
|
-
if (part !== props.commonPath[i] || isDynamicPattern(part)
|
|
167
|
+
if (i === parts.length - 1 || part !== props.commonPath[i] || isDynamicPattern(part)) break;
|
|
168
168
|
newCommonPath.push(part);
|
|
169
169
|
}
|
|
170
170
|
props.depthOffset = newCommonPath.length;
|
|
@@ -173,146 +173,134 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
|
|
|
173
173
|
}
|
|
174
174
|
return result;
|
|
175
175
|
}
|
|
176
|
-
function processPatterns(
|
|
177
|
-
if (typeof patterns === "string") patterns = [patterns];
|
|
178
|
-
if (typeof ignore === "string") ignore = [ignore];
|
|
176
|
+
function processPatterns(options, patterns, props) {
|
|
179
177
|
const matchPatterns = [];
|
|
180
178
|
const ignorePatterns = [];
|
|
181
|
-
for (const pattern of ignore) {
|
|
179
|
+
for (const pattern of options.ignore) {
|
|
182
180
|
if (!pattern) continue;
|
|
183
|
-
if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern,
|
|
181
|
+
if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, options, props, true));
|
|
184
182
|
}
|
|
185
183
|
for (const pattern of patterns) {
|
|
186
184
|
if (!pattern) continue;
|
|
187
|
-
if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern,
|
|
188
|
-
else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1),
|
|
185
|
+
if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern, options, props, false));
|
|
186
|
+
else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), options, props, true));
|
|
189
187
|
}
|
|
190
188
|
return {
|
|
191
189
|
match: matchPatterns,
|
|
192
190
|
ignore: ignorePatterns
|
|
193
191
|
};
|
|
194
192
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
return paths;
|
|
201
|
-
}
|
|
202
|
-
function normalizeCwd(cwd) {
|
|
203
|
-
if (!cwd) return process.cwd().replace(BACKSLASHES, "/");
|
|
204
|
-
if (cwd instanceof URL) return fileURLToPath(cwd).replace(BACKSLASHES, "/");
|
|
205
|
-
return path.resolve(cwd).replace(BACKSLASHES, "/");
|
|
206
|
-
}
|
|
207
|
-
function getCrawler(patterns, inputOptions = {}) {
|
|
208
|
-
const options = process.env.TINYGLOBBY_DEBUG ? {
|
|
209
|
-
...inputOptions,
|
|
210
|
-
debug: true
|
|
211
|
-
} : inputOptions;
|
|
212
|
-
const cwd = normalizeCwd(options.cwd);
|
|
213
|
-
if (options.debug) log("globbing with:", {
|
|
214
|
-
patterns,
|
|
215
|
-
options,
|
|
216
|
-
cwd
|
|
217
|
-
});
|
|
218
|
-
if (Array.isArray(patterns) && patterns.length === 0) return [{
|
|
219
|
-
sync: () => [],
|
|
220
|
-
withPromise: async () => []
|
|
221
|
-
}, false];
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/crawler.ts
|
|
195
|
+
function buildCrawler(options, patterns) {
|
|
196
|
+
const cwd = options.cwd;
|
|
222
197
|
const props = {
|
|
223
198
|
root: cwd,
|
|
224
|
-
commonPath: null,
|
|
225
199
|
depthOffset: 0
|
|
226
200
|
};
|
|
227
|
-
const processed = processPatterns(
|
|
228
|
-
...options,
|
|
229
|
-
patterns
|
|
230
|
-
}, cwd, props);
|
|
201
|
+
const processed = processPatterns(options, patterns, props);
|
|
231
202
|
if (options.debug) log("internal processing patterns:", processed);
|
|
203
|
+
const { absolute, caseSensitiveMatch, debug, dot, followSymbolicLinks, onlyDirectories } = options;
|
|
204
|
+
const root = props.root.replace(BACKSLASHES, "");
|
|
232
205
|
const matchOptions = {
|
|
233
|
-
dot
|
|
206
|
+
dot,
|
|
234
207
|
nobrace: options.braceExpansion === false,
|
|
235
|
-
nocase:
|
|
208
|
+
nocase: !caseSensitiveMatch,
|
|
236
209
|
noextglob: options.extglob === false,
|
|
237
210
|
noglobstar: options.globstar === false,
|
|
238
211
|
posix: true
|
|
239
212
|
};
|
|
240
|
-
const matcher = picomatch(processed.match,
|
|
241
|
-
...matchOptions,
|
|
242
|
-
ignore: processed.ignore
|
|
243
|
-
});
|
|
213
|
+
const matcher = picomatch(processed.match, matchOptions);
|
|
244
214
|
const ignore = picomatch(processed.ignore, matchOptions);
|
|
245
215
|
const partialMatcher = getPartialMatcher(processed.match, matchOptions);
|
|
246
|
-
const format = buildFormat(cwd,
|
|
247
|
-
const
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
216
|
+
const format = buildFormat(cwd, root, absolute);
|
|
217
|
+
const excludeFormatter = absolute ? format : buildFormat(cwd, root, true);
|
|
218
|
+
const excludePredicate = (_, p) => {
|
|
219
|
+
const relativePath = excludeFormatter(p, true);
|
|
220
|
+
return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
|
|
221
|
+
};
|
|
222
|
+
let maxDepth;
|
|
223
|
+
if (options.deep !== void 0) maxDepth = Math.round(options.deep - props.depthOffset);
|
|
224
|
+
const crawler = new fdir({
|
|
225
|
+
filters: [debug ? (p, isDirectory) => {
|
|
226
|
+
const path = format(p, isDirectory);
|
|
227
|
+
const matches = matcher(path) && !ignore(path);
|
|
228
|
+
if (matches) log(`matched ${path}`);
|
|
253
229
|
return matches;
|
|
254
|
-
} : (p, isDirectory) =>
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
230
|
+
} : (p, isDirectory) => {
|
|
231
|
+
const path = format(p, isDirectory);
|
|
232
|
+
return matcher(path) && !ignore(path);
|
|
233
|
+
}],
|
|
234
|
+
exclude: debug ? (_, p) => {
|
|
235
|
+
const skipped = excludePredicate(_, p);
|
|
236
|
+
log(`${skipped ? "skipped" : "crawling"} ${p}`);
|
|
260
237
|
return skipped;
|
|
261
|
-
} :
|
|
262
|
-
|
|
263
|
-
return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
|
|
264
|
-
},
|
|
265
|
-
fs: options.fs ? {
|
|
266
|
-
readdir: options.fs.readdir || nativeFs.readdir,
|
|
267
|
-
readdirSync: options.fs.readdirSync || nativeFs.readdirSync,
|
|
268
|
-
realpath: options.fs.realpath || nativeFs.realpath,
|
|
269
|
-
realpathSync: options.fs.realpathSync || nativeFs.realpathSync,
|
|
270
|
-
stat: options.fs.stat || nativeFs.stat,
|
|
271
|
-
statSync: options.fs.statSync || nativeFs.statSync
|
|
272
|
-
} : void 0,
|
|
238
|
+
} : excludePredicate,
|
|
239
|
+
fs: options.fs,
|
|
273
240
|
pathSeparator: "/",
|
|
274
|
-
relativePaths:
|
|
275
|
-
|
|
241
|
+
relativePaths: !absolute,
|
|
242
|
+
resolvePaths: absolute,
|
|
243
|
+
includeBasePath: absolute,
|
|
244
|
+
resolveSymlinks: followSymbolicLinks,
|
|
245
|
+
excludeSymlinks: !followSymbolicLinks,
|
|
246
|
+
excludeFiles: onlyDirectories,
|
|
247
|
+
includeDirs: onlyDirectories || !options.onlyFiles,
|
|
248
|
+
maxDepth,
|
|
276
249
|
signal: options.signal
|
|
250
|
+
}).crawl(root);
|
|
251
|
+
if (options.debug) log("internal properties:", {
|
|
252
|
+
...props,
|
|
253
|
+
root
|
|
254
|
+
});
|
|
255
|
+
return [crawler, cwd !== root && !absolute && buildRelative(cwd, root)];
|
|
256
|
+
}
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region src/index.ts
|
|
259
|
+
function formatPaths(paths, mapper) {
|
|
260
|
+
if (mapper) for (let i = paths.length - 1; i >= 0; i--) paths[i] = mapper(paths[i]);
|
|
261
|
+
return paths;
|
|
262
|
+
}
|
|
263
|
+
const defaultOptions = {
|
|
264
|
+
caseSensitiveMatch: true,
|
|
265
|
+
cwd: process.cwd(),
|
|
266
|
+
debug: !!process.env.TINYGLOBBY_DEBUG,
|
|
267
|
+
expandDirectories: true,
|
|
268
|
+
followSymbolicLinks: true,
|
|
269
|
+
onlyFiles: true
|
|
270
|
+
};
|
|
271
|
+
function getOptions(options) {
|
|
272
|
+
const opts = {
|
|
273
|
+
...defaultOptions,
|
|
274
|
+
...options
|
|
277
275
|
};
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
if (
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
const
|
|
296
|
-
|
|
276
|
+
opts.cwd = (opts.cwd instanceof URL ? fileURLToPath(opts.cwd) : resolve(opts.cwd)).replace(BACKSLASHES, "/");
|
|
277
|
+
opts.ignore = ensureStringArray(opts.ignore);
|
|
278
|
+
opts.fs && (opts.fs = {
|
|
279
|
+
readdir: opts.fs.readdir || readdir,
|
|
280
|
+
readdirSync: opts.fs.readdirSync || readdirSync,
|
|
281
|
+
realpath: opts.fs.realpath || realpath,
|
|
282
|
+
realpathSync: opts.fs.realpathSync || realpathSync,
|
|
283
|
+
stat: opts.fs.stat || stat,
|
|
284
|
+
statSync: opts.fs.statSync || statSync
|
|
285
|
+
});
|
|
286
|
+
if (opts.debug) log("globbing with options:", opts);
|
|
287
|
+
return opts;
|
|
288
|
+
}
|
|
289
|
+
function getCrawler(globInput, inputOptions = {}) {
|
|
290
|
+
var _ref;
|
|
291
|
+
if (globInput && (inputOptions === null || inputOptions === void 0 ? void 0 : inputOptions.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
|
|
292
|
+
const isModern = isReadonlyArray(globInput) || typeof globInput === "string";
|
|
293
|
+
const patterns = ensureStringArray((_ref = isModern ? globInput : globInput.patterns) !== null && _ref !== void 0 ? _ref : "**/*");
|
|
294
|
+
const options = getOptions(isModern ? inputOptions : globInput);
|
|
295
|
+
return patterns.length > 0 ? buildCrawler(options, patterns) : [];
|
|
297
296
|
}
|
|
298
|
-
async function glob(
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
const opts = isModern ? options : patternsOrOptions;
|
|
302
|
-
const patterns = isModern ? patternsOrOptions : patternsOrOptions.patterns;
|
|
303
|
-
const [crawler, relative] = getCrawler(patterns, opts);
|
|
304
|
-
if (!relative) return crawler.withPromise();
|
|
305
|
-
return formatPaths(await crawler.withPromise(), relative);
|
|
297
|
+
async function glob(globInput, options) {
|
|
298
|
+
const [crawler, relative] = getCrawler(globInput, options);
|
|
299
|
+
return crawler ? formatPaths(await crawler.withPromise(), relative) : [];
|
|
306
300
|
}
|
|
307
|
-
function globSync(
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
const opts = isModern ? options : patternsOrOptions;
|
|
311
|
-
const patterns = isModern ? patternsOrOptions : patternsOrOptions.patterns;
|
|
312
|
-
const [crawler, relative] = getCrawler(patterns, opts);
|
|
313
|
-
if (!relative) return crawler.sync();
|
|
314
|
-
return formatPaths(crawler.sync(), relative);
|
|
301
|
+
function globSync(globInput, options) {
|
|
302
|
+
const [crawler, relative] = getCrawler(globInput, options);
|
|
303
|
+
return crawler ? formatPaths(crawler.sync(), relative) : [];
|
|
315
304
|
}
|
|
316
|
-
|
|
317
305
|
//#endregion
|
|
318
|
-
export { convertPathToPattern, escapePath, glob, globSync, isDynamicPattern };
|
|
306
|
+
export { convertPathToPattern, escapePath, glob, globSync, isDynamicPattern };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinyglobby",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
4
4
|
"description": "A fast and minimal alternative to globby and fast-glob",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -38,18 +38,18 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"fdir": "^6.5.0",
|
|
41
|
-
"picomatch": "^4.0.
|
|
41
|
+
"picomatch": "^4.0.4"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@biomejs/biome": "^2.
|
|
45
|
-
"@types/node": "^
|
|
46
|
-
"@types/picomatch": "^4.0.
|
|
44
|
+
"@biomejs/biome": "^2.4.10",
|
|
45
|
+
"@types/node": "^25.5.2",
|
|
46
|
+
"@types/picomatch": "^4.0.3",
|
|
47
47
|
"fast-glob": "^3.3.3",
|
|
48
|
-
"fs-fixture": "^2.
|
|
49
|
-
"glob": "^
|
|
50
|
-
"tinybench": "^
|
|
51
|
-
"tsdown": "^0.
|
|
52
|
-
"typescript": "^
|
|
48
|
+
"fs-fixture": "^2.13.0",
|
|
49
|
+
"glob": "^13.0.6",
|
|
50
|
+
"tinybench": "^6.0.0",
|
|
51
|
+
"tsdown": "^0.21.7",
|
|
52
|
+
"typescript": "^6.0.2"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
55
|
"node": ">=12.0.0"
|