@better-t-stack/template-generator 3.27.2 → 3.27.4
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/core/template-reader.d.mts +16 -1
- package/dist/core/template-reader.d.mts.map +1 -1
- package/dist/core/template-reader.mjs +3 -4
- package/dist/fs-writer.d.mts +3 -3
- package/dist/fs-writer.d.mts.map +1 -1
- package/dist/fs-writer.mjs +2 -3
- package/dist/fs-writer.mjs.map +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +13 -61
- package/dist/index.mjs.map +1 -1
- package/dist/{is-binary-path-BN88l03c.mjs → is-binary-path-maAgJE_Q.mjs} +6 -14
- package/dist/is-binary-path-maAgJE_Q.mjs.map +1 -0
- package/dist/{template-reader-DOXCnctl.mjs → template-reader-C8MBRmk-.mjs} +532 -351
- package/dist/template-reader-C8MBRmk-.mjs.map +1 -0
- package/dist/{types-zSU486rU.d.mts → types-CzW_c7t0.d.mts} +3 -3
- package/dist/types-CzW_c7t0.d.mts.map +1 -0
- package/package.json +11 -11
- package/dist/is-binary-path-BN88l03c.mjs.map +0 -1
- package/dist/template-reader-DOXCnctl.mjs.map +0 -1
- package/dist/types-zSU486rU.d.mts.map +0 -1
|
@@ -1,32 +1,27 @@
|
|
|
1
|
-
import { t as isBinaryPath } from "./is-binary-path-
|
|
1
|
+
import { t as isBinaryPath } from "./is-binary-path-maAgJE_Q.mjs";
|
|
2
2
|
import { dirname, join } from "pathe";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import * as nativeFs
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import * as nativeFs from "fs";
|
|
6
|
+
import { readdir, readdirSync, realpath, realpathSync, stat, statSync } from "fs";
|
|
7
|
+
import { basename, dirname as dirname$1, isAbsolute, normalize as normalize$1, posix, relative, resolve, sep } from "path";
|
|
8
8
|
import { fileURLToPath as fileURLToPath$1 } from "url";
|
|
9
9
|
import { createRequire } from "module";
|
|
10
|
-
|
|
11
|
-
//#region rolldown:runtime
|
|
10
|
+
//#region \0rolldown/runtime.js
|
|
12
11
|
var __create = Object.create;
|
|
13
12
|
var __defProp = Object.defineProperty;
|
|
14
13
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
15
14
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
16
15
|
var __getProtoOf = Object.getPrototypeOf;
|
|
17
16
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
18
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
17
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
19
18
|
var __copyProps = (to, from, except, desc) => {
|
|
20
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
20
|
+
key = keys[i];
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
22
|
+
get: ((k) => from[k]).bind(null, key),
|
|
23
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
24
|
+
});
|
|
30
25
|
}
|
|
31
26
|
return to;
|
|
32
27
|
};
|
|
@@ -34,30 +29,29 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
29
|
value: mod,
|
|
35
30
|
enumerable: true
|
|
36
31
|
}) : target, mod));
|
|
37
|
-
|
|
38
32
|
//#endregion
|
|
39
|
-
//#region ../../node_modules/.bun/fdir@6.5.0+
|
|
33
|
+
//#region ../../node_modules/.bun/fdir@6.5.0+5b2c60377f53a28e/node_modules/fdir/dist/index.mjs
|
|
40
34
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
41
|
-
function cleanPath(path
|
|
42
|
-
let normalized = normalize$1(path
|
|
35
|
+
function cleanPath(path) {
|
|
36
|
+
let normalized = normalize$1(path);
|
|
43
37
|
if (normalized.length > 1 && normalized[normalized.length - 1] === sep) normalized = normalized.substring(0, normalized.length - 1);
|
|
44
38
|
return normalized;
|
|
45
39
|
}
|
|
46
40
|
const SLASHES_REGEX = /[\\/]/g;
|
|
47
|
-
function convertSlashes(path
|
|
48
|
-
return path
|
|
41
|
+
function convertSlashes(path, separator) {
|
|
42
|
+
return path.replace(SLASHES_REGEX, separator);
|
|
49
43
|
}
|
|
50
44
|
const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
|
|
51
|
-
function isRootDirectory(path
|
|
52
|
-
return path
|
|
45
|
+
function isRootDirectory(path) {
|
|
46
|
+
return path === "/" || WINDOWS_ROOT_DIR_REGEX.test(path);
|
|
53
47
|
}
|
|
54
|
-
function normalizePath(path
|
|
48
|
+
function normalizePath(path, options) {
|
|
55
49
|
const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
|
|
56
|
-
const pathNeedsCleaning = process.platform === "win32" && path
|
|
57
|
-
if (resolvePaths) path
|
|
58
|
-
if (normalizePath$1 || pathNeedsCleaning) path
|
|
59
|
-
if (path
|
|
60
|
-
return convertSlashes(path
|
|
50
|
+
const pathNeedsCleaning = process.platform === "win32" && path.includes("/") || path.startsWith(".");
|
|
51
|
+
if (resolvePaths) path = resolve(path);
|
|
52
|
+
if (normalizePath$1 || pathNeedsCleaning) path = cleanPath(path);
|
|
53
|
+
if (path === ".") return "";
|
|
54
|
+
return convertSlashes(path[path.length - 1] !== pathSeparator ? path + pathSeparator : path, pathSeparator);
|
|
61
55
|
}
|
|
62
56
|
function joinPathWithBasePath(filename, directoryPath) {
|
|
63
57
|
return directoryPath + filename;
|
|
@@ -93,8 +87,8 @@ const pushDirectory = (directoryPath, paths) => {
|
|
|
93
87
|
paths.push(directoryPath || ".");
|
|
94
88
|
};
|
|
95
89
|
const pushDirectoryFilter = (directoryPath, paths, filters) => {
|
|
96
|
-
const path
|
|
97
|
-
if (filters.every((filter) => filter(path
|
|
90
|
+
const path = directoryPath || ".";
|
|
91
|
+
if (filters.every((filter) => filter(path, true))) paths.push(path);
|
|
98
92
|
};
|
|
99
93
|
const empty$2 = () => {};
|
|
100
94
|
function build$6(root, options) {
|
|
@@ -143,26 +137,26 @@ const empty = () => {};
|
|
|
143
137
|
function build$3(options) {
|
|
144
138
|
return options.group ? groupFiles : empty;
|
|
145
139
|
}
|
|
146
|
-
const resolveSymlinksAsync = function(path
|
|
147
|
-
const { queue, fs
|
|
140
|
+
const resolveSymlinksAsync = function(path, state, callback$1) {
|
|
141
|
+
const { queue, fs, options: { suppressErrors } } = state;
|
|
148
142
|
queue.enqueue();
|
|
149
|
-
fs
|
|
143
|
+
fs.realpath(path, (error, resolvedPath) => {
|
|
150
144
|
if (error) return queue.dequeue(suppressErrors ? null : error, state);
|
|
151
|
-
fs
|
|
145
|
+
fs.stat(resolvedPath, (error$1, stat) => {
|
|
152
146
|
if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
|
|
153
|
-
if (stat.isDirectory() && isRecursive(path
|
|
147
|
+
if (stat.isDirectory() && isRecursive(path, resolvedPath, state)) return queue.dequeue(null, state);
|
|
154
148
|
callback$1(stat, resolvedPath);
|
|
155
149
|
queue.dequeue(null, state);
|
|
156
150
|
});
|
|
157
151
|
});
|
|
158
152
|
};
|
|
159
|
-
const resolveSymlinks = function(path
|
|
160
|
-
const { queue, fs
|
|
153
|
+
const resolveSymlinks = function(path, state, callback$1) {
|
|
154
|
+
const { queue, fs, options: { suppressErrors } } = state;
|
|
161
155
|
queue.enqueue();
|
|
162
156
|
try {
|
|
163
|
-
const resolvedPath = fs
|
|
164
|
-
const stat = fs
|
|
165
|
-
if (stat.isDirectory() && isRecursive(path
|
|
157
|
+
const resolvedPath = fs.realpathSync(path);
|
|
158
|
+
const stat = fs.statSync(resolvedPath);
|
|
159
|
+
if (stat.isDirectory() && isRecursive(path, resolvedPath, state)) return;
|
|
166
160
|
callback$1(stat, resolvedPath);
|
|
167
161
|
} catch (e) {
|
|
168
162
|
if (!suppressErrors) throw e;
|
|
@@ -172,17 +166,17 @@ function build$2(options, isSynchronous) {
|
|
|
172
166
|
if (!options.resolveSymlinks || options.excludeSymlinks) return null;
|
|
173
167
|
return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
|
|
174
168
|
}
|
|
175
|
-
function isRecursive(path
|
|
169
|
+
function isRecursive(path, resolved, state) {
|
|
176
170
|
if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
|
|
177
|
-
let parent = dirname$1(path
|
|
178
|
-
let depth
|
|
179
|
-
while (parent !== state.root && depth
|
|
171
|
+
let parent = dirname$1(path);
|
|
172
|
+
let depth = 1;
|
|
173
|
+
while (parent !== state.root && depth < 2) {
|
|
180
174
|
const resolvedPath = state.symlinks.get(parent);
|
|
181
|
-
if (!!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath))) depth
|
|
175
|
+
if (!!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath))) depth++;
|
|
182
176
|
else parent = dirname$1(parent);
|
|
183
177
|
}
|
|
184
|
-
state.symlinks.set(path
|
|
185
|
-
return depth
|
|
178
|
+
state.symlinks.set(path, resolved);
|
|
179
|
+
return depth > 1;
|
|
186
180
|
}
|
|
187
181
|
function isRecursiveUsingRealPaths(resolved, state) {
|
|
188
182
|
return state.visited.includes(resolved + state.options.pathSeparator);
|
|
@@ -230,22 +224,22 @@ const readdirOpts = { withFileTypes: true };
|
|
|
230
224
|
const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
|
|
231
225
|
state.queue.enqueue();
|
|
232
226
|
if (currentDepth < 0) return state.queue.dequeue(null, state);
|
|
233
|
-
const { fs
|
|
227
|
+
const { fs } = state;
|
|
234
228
|
state.visited.push(crawlPath);
|
|
235
229
|
state.counts.directories++;
|
|
236
|
-
fs
|
|
230
|
+
fs.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
|
|
237
231
|
callback$1(entries, directoryPath, currentDepth);
|
|
238
232
|
state.queue.dequeue(state.options.suppressErrors ? null : error, state);
|
|
239
233
|
});
|
|
240
234
|
};
|
|
241
235
|
const walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
|
|
242
|
-
const { fs
|
|
236
|
+
const { fs } = state;
|
|
243
237
|
if (currentDepth < 0) return;
|
|
244
238
|
state.visited.push(crawlPath);
|
|
245
239
|
state.counts.directories++;
|
|
246
240
|
let entries = [];
|
|
247
241
|
try {
|
|
248
|
-
entries = fs
|
|
242
|
+
entries = fs.readdirSync(crawlPath || ".", readdirOpts);
|
|
249
243
|
} catch (e) {
|
|
250
244
|
if (!state.options.suppressErrors) throw e;
|
|
251
245
|
}
|
|
@@ -337,7 +331,7 @@ var Walker = class {
|
|
|
337
331
|
symlinks: /* @__PURE__ */ new Map(),
|
|
338
332
|
visited: [""].slice(0, 0),
|
|
339
333
|
controller: new Aborter(),
|
|
340
|
-
fs: options.fs || nativeFs
|
|
334
|
+
fs: options.fs || nativeFs
|
|
341
335
|
};
|
|
342
336
|
this.joinPath = build$7(this.root, options);
|
|
343
337
|
this.pushDirectory = build$6(this.root, options);
|
|
@@ -352,7 +346,7 @@ var Walker = class {
|
|
|
352
346
|
this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
|
|
353
347
|
return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
|
|
354
348
|
}
|
|
355
|
-
walk = (entries, directoryPath, depth
|
|
349
|
+
walk = (entries, directoryPath, depth) => {
|
|
356
350
|
const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state;
|
|
357
351
|
if (controller.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles) return;
|
|
358
352
|
const files = this.getArray(this.state.paths);
|
|
@@ -362,19 +356,19 @@ var Walker = class {
|
|
|
362
356
|
const filename = this.joinPath(entry.name, directoryPath);
|
|
363
357
|
this.pushFile(filename, files, this.state.counts, filters);
|
|
364
358
|
} else if (entry.isDirectory()) {
|
|
365
|
-
let path
|
|
366
|
-
if (exclude && exclude(entry.name, path
|
|
367
|
-
this.pushDirectory(path
|
|
368
|
-
this.walkDirectory(this.state, path
|
|
359
|
+
let path = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
|
|
360
|
+
if (exclude && exclude(entry.name, path)) continue;
|
|
361
|
+
this.pushDirectory(path, paths, filters);
|
|
362
|
+
this.walkDirectory(this.state, path, path, depth - 1, this.walk);
|
|
369
363
|
} else if (this.resolveSymlink && entry.isSymbolicLink()) {
|
|
370
|
-
let path
|
|
371
|
-
this.resolveSymlink(path
|
|
364
|
+
let path = joinPathWithBasePath(entry.name, directoryPath);
|
|
365
|
+
this.resolveSymlink(path, this.state, (stat, resolvedPath) => {
|
|
372
366
|
if (stat.isDirectory()) {
|
|
373
367
|
resolvedPath = normalizePath(resolvedPath, this.state.options);
|
|
374
|
-
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path
|
|
375
|
-
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path
|
|
368
|
+
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path + pathSeparator)) return;
|
|
369
|
+
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth - 1, this.walk);
|
|
376
370
|
} else {
|
|
377
|
-
resolvedPath = useRealPaths ? resolvedPath : path
|
|
371
|
+
resolvedPath = useRealPaths ? resolvedPath : path;
|
|
378
372
|
const filename = basename(resolvedPath);
|
|
379
373
|
const directoryPath$1 = normalizePath(dirname$1(resolvedPath), this.state.options);
|
|
380
374
|
resolvedPath = this.joinPath(filename, directoryPath$1);
|
|
@@ -457,8 +451,8 @@ var Builder = class {
|
|
|
457
451
|
this.options.includeDirs = true;
|
|
458
452
|
return this;
|
|
459
453
|
}
|
|
460
|
-
withMaxDepth(depth
|
|
461
|
-
this.options.maxDepth = depth
|
|
454
|
+
withMaxDepth(depth) {
|
|
455
|
+
this.options.maxDepth = depth;
|
|
462
456
|
return this;
|
|
463
457
|
}
|
|
464
458
|
withMaxFiles(limit) {
|
|
@@ -539,16 +533,16 @@ var Builder = class {
|
|
|
539
533
|
isMatch = globFn(patterns, ...options);
|
|
540
534
|
this.globCache[patterns.join("\0")] = isMatch;
|
|
541
535
|
}
|
|
542
|
-
this.options.filters.push((path
|
|
536
|
+
this.options.filters.push((path) => isMatch(path));
|
|
543
537
|
return this;
|
|
544
538
|
}
|
|
545
539
|
};
|
|
546
|
-
|
|
547
540
|
//#endregion
|
|
548
|
-
//#region ../../node_modules/.bun/picomatch@4.0.
|
|
541
|
+
//#region ../../node_modules/.bun/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
|
|
549
542
|
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
550
543
|
const WIN_SLASH = "\\\\/";
|
|
551
544
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
545
|
+
const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
552
546
|
/**
|
|
553
547
|
* Posix glob regex
|
|
554
548
|
*/
|
|
@@ -597,28 +591,26 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
597
591
|
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
|
598
592
|
SEP: "\\"
|
|
599
593
|
};
|
|
600
|
-
/**
|
|
601
|
-
* POSIX Bracket Regex
|
|
602
|
-
*/
|
|
603
|
-
const POSIX_REGEX_SOURCE$1 = {
|
|
604
|
-
alnum: "a-zA-Z0-9",
|
|
605
|
-
alpha: "a-zA-Z",
|
|
606
|
-
ascii: "\\x00-\\x7F",
|
|
607
|
-
blank: " \\t",
|
|
608
|
-
cntrl: "\\x00-\\x1F\\x7F",
|
|
609
|
-
digit: "0-9",
|
|
610
|
-
graph: "\\x21-\\x7E",
|
|
611
|
-
lower: "a-z",
|
|
612
|
-
print: "\\x20-\\x7E ",
|
|
613
|
-
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
614
|
-
space: " \\t\\r\\n\\v\\f",
|
|
615
|
-
upper: "A-Z",
|
|
616
|
-
word: "A-Za-z0-9_",
|
|
617
|
-
xdigit: "A-Fa-f0-9"
|
|
618
|
-
};
|
|
619
594
|
module.exports = {
|
|
595
|
+
DEFAULT_MAX_EXTGLOB_RECURSION,
|
|
620
596
|
MAX_LENGTH: 1024 * 64,
|
|
621
|
-
POSIX_REGEX_SOURCE:
|
|
597
|
+
POSIX_REGEX_SOURCE: {
|
|
598
|
+
__proto__: null,
|
|
599
|
+
alnum: "a-zA-Z0-9",
|
|
600
|
+
alpha: "a-zA-Z",
|
|
601
|
+
ascii: "\\x00-\\x7F",
|
|
602
|
+
blank: " \\t",
|
|
603
|
+
cntrl: "\\x00-\\x1F\\x7F",
|
|
604
|
+
digit: "0-9",
|
|
605
|
+
graph: "\\x21-\\x7E",
|
|
606
|
+
lower: "a-z",
|
|
607
|
+
print: "\\x20-\\x7E ",
|
|
608
|
+
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
609
|
+
space: " \\t\\r\\n\\v\\f",
|
|
610
|
+
upper: "A-Z",
|
|
611
|
+
word: "A-Za-z0-9_",
|
|
612
|
+
xdigit: "A-Fa-f0-9"
|
|
613
|
+
},
|
|
622
614
|
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
623
615
|
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
624
616
|
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
@@ -708,9 +700,8 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
708
700
|
}
|
|
709
701
|
};
|
|
710
702
|
}));
|
|
711
|
-
|
|
712
703
|
//#endregion
|
|
713
|
-
//#region ../../node_modules/.bun/picomatch@4.0.
|
|
704
|
+
//#region ../../node_modules/.bun/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
|
|
714
705
|
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
715
706
|
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
|
|
716
707
|
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
@@ -750,18 +741,17 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
750
741
|
if (state.negated === true) output = `(?:^(?!${output}).*$)`;
|
|
751
742
|
return output;
|
|
752
743
|
};
|
|
753
|
-
exports.basename = (path
|
|
754
|
-
const segs = path
|
|
744
|
+
exports.basename = (path, { windows } = {}) => {
|
|
745
|
+
const segs = path.split(windows ? /[\\/]/ : "/");
|
|
755
746
|
const last = segs[segs.length - 1];
|
|
756
747
|
if (last === "") return segs[segs.length - 2];
|
|
757
748
|
return last;
|
|
758
749
|
};
|
|
759
750
|
}));
|
|
760
|
-
|
|
761
751
|
//#endregion
|
|
762
|
-
//#region ../../node_modules/.bun/picomatch@4.0.
|
|
752
|
+
//#region ../../node_modules/.bun/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
|
|
763
753
|
var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
764
|
-
const utils
|
|
754
|
+
const utils = require_utils();
|
|
765
755
|
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
|
|
766
756
|
const isPathSeparator = (code) => {
|
|
767
757
|
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
@@ -785,7 +775,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
785
775
|
* @return {Object} Returns an object with tokens and regex source string.
|
|
786
776
|
* @api public
|
|
787
777
|
*/
|
|
788
|
-
const scan
|
|
778
|
+
const scan = (input, options) => {
|
|
789
779
|
const opts = options || {};
|
|
790
780
|
const length = input.length - 1;
|
|
791
781
|
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
@@ -973,7 +963,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
973
963
|
}
|
|
974
964
|
let base = str;
|
|
975
965
|
let prefix = "";
|
|
976
|
-
let glob
|
|
966
|
+
let glob = "";
|
|
977
967
|
if (start > 0) {
|
|
978
968
|
prefix = str.slice(0, start);
|
|
979
969
|
str = str.slice(start);
|
|
@@ -981,24 +971,24 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
981
971
|
}
|
|
982
972
|
if (base && isGlob === true && lastIndex > 0) {
|
|
983
973
|
base = str.slice(0, lastIndex);
|
|
984
|
-
glob
|
|
974
|
+
glob = str.slice(lastIndex);
|
|
985
975
|
} else if (isGlob === true) {
|
|
986
976
|
base = "";
|
|
987
|
-
glob
|
|
977
|
+
glob = str;
|
|
988
978
|
} else base = str;
|
|
989
979
|
if (base && base !== "" && base !== "/" && base !== str) {
|
|
990
980
|
if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
|
|
991
981
|
}
|
|
992
982
|
if (opts.unescape === true) {
|
|
993
|
-
if (glob
|
|
994
|
-
if (base && backslashes === true) base = utils
|
|
983
|
+
if (glob) glob = utils.removeBackslashes(glob);
|
|
984
|
+
if (base && backslashes === true) base = utils.removeBackslashes(base);
|
|
995
985
|
}
|
|
996
986
|
const state = {
|
|
997
987
|
prefix,
|
|
998
988
|
input,
|
|
999
989
|
start,
|
|
1000
990
|
base,
|
|
1001
|
-
glob
|
|
991
|
+
glob,
|
|
1002
992
|
isBrace,
|
|
1003
993
|
isBracket,
|
|
1004
994
|
isGlob,
|
|
@@ -1043,18 +1033,17 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1043
1033
|
}
|
|
1044
1034
|
return state;
|
|
1045
1035
|
};
|
|
1046
|
-
module.exports = scan
|
|
1036
|
+
module.exports = scan;
|
|
1047
1037
|
}));
|
|
1048
|
-
|
|
1049
1038
|
//#endregion
|
|
1050
|
-
//#region ../../node_modules/.bun/picomatch@4.0.
|
|
1039
|
+
//#region ../../node_modules/.bun/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
|
|
1051
1040
|
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1052
|
-
const constants
|
|
1053
|
-
const utils
|
|
1041
|
+
const constants = require_constants();
|
|
1042
|
+
const utils = require_utils();
|
|
1054
1043
|
/**
|
|
1055
1044
|
* Constants
|
|
1056
1045
|
*/
|
|
1057
|
-
const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants
|
|
1046
|
+
const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants;
|
|
1058
1047
|
/**
|
|
1059
1048
|
* Helpers
|
|
1060
1049
|
*/
|
|
@@ -1065,7 +1054,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1065
1054
|
try {
|
|
1066
1055
|
new RegExp(value);
|
|
1067
1056
|
} catch (ex) {
|
|
1068
|
-
return args.map((v) => utils
|
|
1057
|
+
return args.map((v) => utils.escapeRegex(v)).join("..");
|
|
1069
1058
|
}
|
|
1070
1059
|
return value;
|
|
1071
1060
|
};
|
|
@@ -1075,13 +1064,184 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1075
1064
|
const syntaxError = (type, char) => {
|
|
1076
1065
|
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
1077
1066
|
};
|
|
1067
|
+
const splitTopLevel = (input) => {
|
|
1068
|
+
const parts = [];
|
|
1069
|
+
let bracket = 0;
|
|
1070
|
+
let paren = 0;
|
|
1071
|
+
let quote = 0;
|
|
1072
|
+
let value = "";
|
|
1073
|
+
let escaped = false;
|
|
1074
|
+
for (const ch of input) {
|
|
1075
|
+
if (escaped === true) {
|
|
1076
|
+
value += ch;
|
|
1077
|
+
escaped = false;
|
|
1078
|
+
continue;
|
|
1079
|
+
}
|
|
1080
|
+
if (ch === "\\") {
|
|
1081
|
+
value += ch;
|
|
1082
|
+
escaped = true;
|
|
1083
|
+
continue;
|
|
1084
|
+
}
|
|
1085
|
+
if (ch === "\"") {
|
|
1086
|
+
quote = quote === 1 ? 0 : 1;
|
|
1087
|
+
value += ch;
|
|
1088
|
+
continue;
|
|
1089
|
+
}
|
|
1090
|
+
if (quote === 0) {
|
|
1091
|
+
if (ch === "[") bracket++;
|
|
1092
|
+
else if (ch === "]" && bracket > 0) bracket--;
|
|
1093
|
+
else if (bracket === 0) {
|
|
1094
|
+
if (ch === "(") paren++;
|
|
1095
|
+
else if (ch === ")" && paren > 0) paren--;
|
|
1096
|
+
else if (ch === "|" && paren === 0) {
|
|
1097
|
+
parts.push(value);
|
|
1098
|
+
value = "";
|
|
1099
|
+
continue;
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
value += ch;
|
|
1104
|
+
}
|
|
1105
|
+
parts.push(value);
|
|
1106
|
+
return parts;
|
|
1107
|
+
};
|
|
1108
|
+
const isPlainBranch = (branch) => {
|
|
1109
|
+
let escaped = false;
|
|
1110
|
+
for (const ch of branch) {
|
|
1111
|
+
if (escaped === true) {
|
|
1112
|
+
escaped = false;
|
|
1113
|
+
continue;
|
|
1114
|
+
}
|
|
1115
|
+
if (ch === "\\") {
|
|
1116
|
+
escaped = true;
|
|
1117
|
+
continue;
|
|
1118
|
+
}
|
|
1119
|
+
if (/[?*+@!()[\]{}]/.test(ch)) return false;
|
|
1120
|
+
}
|
|
1121
|
+
return true;
|
|
1122
|
+
};
|
|
1123
|
+
const normalizeSimpleBranch = (branch) => {
|
|
1124
|
+
let value = branch.trim();
|
|
1125
|
+
let changed = true;
|
|
1126
|
+
while (changed === true) {
|
|
1127
|
+
changed = false;
|
|
1128
|
+
if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
|
|
1129
|
+
value = value.slice(2, -1);
|
|
1130
|
+
changed = true;
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
if (!isPlainBranch(value)) return;
|
|
1134
|
+
return value.replace(/\\(.)/g, "$1");
|
|
1135
|
+
};
|
|
1136
|
+
const hasRepeatedCharPrefixOverlap = (branches) => {
|
|
1137
|
+
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
1138
|
+
for (let i = 0; i < values.length; i++) for (let j = i + 1; j < values.length; j++) {
|
|
1139
|
+
const a = values[i];
|
|
1140
|
+
const b = values[j];
|
|
1141
|
+
const char = a[0];
|
|
1142
|
+
if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) continue;
|
|
1143
|
+
if (a === b || a.startsWith(b) || b.startsWith(a)) return true;
|
|
1144
|
+
}
|
|
1145
|
+
return false;
|
|
1146
|
+
};
|
|
1147
|
+
const parseRepeatedExtglob = (pattern, requireEnd = true) => {
|
|
1148
|
+
if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") return;
|
|
1149
|
+
let bracket = 0;
|
|
1150
|
+
let paren = 0;
|
|
1151
|
+
let quote = 0;
|
|
1152
|
+
let escaped = false;
|
|
1153
|
+
for (let i = 1; i < pattern.length; i++) {
|
|
1154
|
+
const ch = pattern[i];
|
|
1155
|
+
if (escaped === true) {
|
|
1156
|
+
escaped = false;
|
|
1157
|
+
continue;
|
|
1158
|
+
}
|
|
1159
|
+
if (ch === "\\") {
|
|
1160
|
+
escaped = true;
|
|
1161
|
+
continue;
|
|
1162
|
+
}
|
|
1163
|
+
if (ch === "\"") {
|
|
1164
|
+
quote = quote === 1 ? 0 : 1;
|
|
1165
|
+
continue;
|
|
1166
|
+
}
|
|
1167
|
+
if (quote === 1) continue;
|
|
1168
|
+
if (ch === "[") {
|
|
1169
|
+
bracket++;
|
|
1170
|
+
continue;
|
|
1171
|
+
}
|
|
1172
|
+
if (ch === "]" && bracket > 0) {
|
|
1173
|
+
bracket--;
|
|
1174
|
+
continue;
|
|
1175
|
+
}
|
|
1176
|
+
if (bracket > 0) continue;
|
|
1177
|
+
if (ch === "(") {
|
|
1178
|
+
paren++;
|
|
1179
|
+
continue;
|
|
1180
|
+
}
|
|
1181
|
+
if (ch === ")") {
|
|
1182
|
+
paren--;
|
|
1183
|
+
if (paren === 0) {
|
|
1184
|
+
if (requireEnd === true && i !== pattern.length - 1) return;
|
|
1185
|
+
return {
|
|
1186
|
+
type: pattern[0],
|
|
1187
|
+
body: pattern.slice(2, i),
|
|
1188
|
+
end: i
|
|
1189
|
+
};
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
};
|
|
1194
|
+
const getStarExtglobSequenceOutput = (pattern) => {
|
|
1195
|
+
let index = 0;
|
|
1196
|
+
const chars = [];
|
|
1197
|
+
while (index < pattern.length) {
|
|
1198
|
+
const match = parseRepeatedExtglob(pattern.slice(index), false);
|
|
1199
|
+
if (!match || match.type !== "*") return;
|
|
1200
|
+
const branches = splitTopLevel(match.body).map((branch) => branch.trim());
|
|
1201
|
+
if (branches.length !== 1) return;
|
|
1202
|
+
const branch = normalizeSimpleBranch(branches[0]);
|
|
1203
|
+
if (!branch || branch.length !== 1) return;
|
|
1204
|
+
chars.push(branch);
|
|
1205
|
+
index += match.end + 1;
|
|
1206
|
+
}
|
|
1207
|
+
if (chars.length < 1) return;
|
|
1208
|
+
return `${chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`}*`;
|
|
1209
|
+
};
|
|
1210
|
+
const repeatedExtglobRecursion = (pattern) => {
|
|
1211
|
+
let depth = 0;
|
|
1212
|
+
let value = pattern.trim();
|
|
1213
|
+
let match = parseRepeatedExtglob(value);
|
|
1214
|
+
while (match) {
|
|
1215
|
+
depth++;
|
|
1216
|
+
value = match.body.trim();
|
|
1217
|
+
match = parseRepeatedExtglob(value);
|
|
1218
|
+
}
|
|
1219
|
+
return depth;
|
|
1220
|
+
};
|
|
1221
|
+
const analyzeRepeatedExtglob = (body, options) => {
|
|
1222
|
+
if (options.maxExtglobRecursion === false) return { risky: false };
|
|
1223
|
+
const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
1224
|
+
const branches = splitTopLevel(body).map((branch) => branch.trim());
|
|
1225
|
+
if (branches.length > 1) {
|
|
1226
|
+
if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return { risky: true };
|
|
1227
|
+
}
|
|
1228
|
+
for (const branch of branches) {
|
|
1229
|
+
const safeOutput = getStarExtglobSequenceOutput(branch);
|
|
1230
|
+
if (safeOutput) return {
|
|
1231
|
+
risky: true,
|
|
1232
|
+
safeOutput
|
|
1233
|
+
};
|
|
1234
|
+
if (repeatedExtglobRecursion(branch) > max) return { risky: true };
|
|
1235
|
+
}
|
|
1236
|
+
return { risky: false };
|
|
1237
|
+
};
|
|
1078
1238
|
/**
|
|
1079
1239
|
* Parse the given input string.
|
|
1080
1240
|
* @param {String} input
|
|
1081
1241
|
* @param {Object} options
|
|
1082
1242
|
* @return {Object}
|
|
1083
1243
|
*/
|
|
1084
|
-
const parse
|
|
1244
|
+
const parse = (input, options) => {
|
|
1085
1245
|
if (typeof input !== "string") throw new TypeError("Expected a string");
|
|
1086
1246
|
input = REPLACEMENTS[input] || input;
|
|
1087
1247
|
const opts = { ...options };
|
|
@@ -1095,14 +1255,14 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1095
1255
|
};
|
|
1096
1256
|
const tokens = [bos];
|
|
1097
1257
|
const capture = opts.capture ? "" : "?:";
|
|
1098
|
-
const PLATFORM_CHARS = constants
|
|
1099
|
-
const EXTGLOB_CHARS = constants
|
|
1100
|
-
const { DOT_LITERAL
|
|
1101
|
-
const globstar = (opts
|
|
1102
|
-
return `(${capture}(?:(?!${START_ANCHOR
|
|
1258
|
+
const PLATFORM_CHARS = constants.globChars(opts.windows);
|
|
1259
|
+
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
|
1260
|
+
const { DOT_LITERAL, PLUS_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK, QMARK_NO_DOT, STAR, START_ANCHOR } = PLATFORM_CHARS;
|
|
1261
|
+
const globstar = (opts) => {
|
|
1262
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
1103
1263
|
};
|
|
1104
1264
|
const nodot = opts.dot ? "" : NO_DOT;
|
|
1105
|
-
const qmarkNoDot = opts.dot ? QMARK
|
|
1265
|
+
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
1106
1266
|
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
1107
1267
|
if (opts.capture) star = `(${star})`;
|
|
1108
1268
|
if (typeof opts.noext === "boolean") opts.noextglob = opts.noext;
|
|
@@ -1123,7 +1283,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1123
1283
|
globstar: false,
|
|
1124
1284
|
tokens
|
|
1125
1285
|
};
|
|
1126
|
-
input = utils
|
|
1286
|
+
input = utils.removePrefix(input, state);
|
|
1127
1287
|
len = input.length;
|
|
1128
1288
|
const extglobs = [];
|
|
1129
1289
|
const braces = [];
|
|
@@ -1137,8 +1297,8 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1137
1297
|
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
1138
1298
|
const advance = state.advance = () => input[++state.index] || "";
|
|
1139
1299
|
const remaining = () => input.slice(state.index + 1);
|
|
1140
|
-
const consume = (value
|
|
1141
|
-
state.consumed += value
|
|
1300
|
+
const consume = (value = "", num = 0) => {
|
|
1301
|
+
state.consumed += value;
|
|
1142
1302
|
state.index += num;
|
|
1143
1303
|
};
|
|
1144
1304
|
const append = (token) => {
|
|
@@ -1195,21 +1355,23 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1195
1355
|
tokens.push(tok);
|
|
1196
1356
|
prev = tok;
|
|
1197
1357
|
};
|
|
1198
|
-
const extglobOpen = (type, value
|
|
1358
|
+
const extglobOpen = (type, value) => {
|
|
1199
1359
|
const token = {
|
|
1200
|
-
...EXTGLOB_CHARS[value
|
|
1360
|
+
...EXTGLOB_CHARS[value],
|
|
1201
1361
|
conditions: 1,
|
|
1202
1362
|
inner: ""
|
|
1203
1363
|
};
|
|
1204
1364
|
token.prev = prev;
|
|
1205
1365
|
token.parens = state.parens;
|
|
1206
1366
|
token.output = state.output;
|
|
1367
|
+
token.startIndex = state.index;
|
|
1368
|
+
token.tokensIndex = tokens.length;
|
|
1207
1369
|
const output = (opts.capture ? "(" : "") + token.open;
|
|
1208
1370
|
increment("parens");
|
|
1209
1371
|
push({
|
|
1210
1372
|
type,
|
|
1211
|
-
value
|
|
1212
|
-
output: state.output ? "" : ONE_CHAR
|
|
1373
|
+
value,
|
|
1374
|
+
output: state.output ? "" : ONE_CHAR
|
|
1213
1375
|
});
|
|
1214
1376
|
push({
|
|
1215
1377
|
type: "paren",
|
|
@@ -1220,13 +1382,37 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1220
1382
|
extglobs.push(token);
|
|
1221
1383
|
};
|
|
1222
1384
|
const extglobClose = (token) => {
|
|
1385
|
+
const literal = input.slice(token.startIndex, state.index + 1);
|
|
1386
|
+
const analysis = analyzeRepeatedExtglob(input.slice(token.startIndex + 2, state.index), opts);
|
|
1387
|
+
if ((token.type === "plus" || token.type === "star") && analysis.risky) {
|
|
1388
|
+
const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
|
|
1389
|
+
const open = tokens[token.tokensIndex];
|
|
1390
|
+
open.type = "text";
|
|
1391
|
+
open.value = literal;
|
|
1392
|
+
open.output = safeOutput || utils.escapeRegex(literal);
|
|
1393
|
+
for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
|
|
1394
|
+
tokens[i].value = "";
|
|
1395
|
+
tokens[i].output = "";
|
|
1396
|
+
delete tokens[i].suffix;
|
|
1397
|
+
}
|
|
1398
|
+
state.output = token.output + open.output;
|
|
1399
|
+
state.backtrack = true;
|
|
1400
|
+
push({
|
|
1401
|
+
type: "paren",
|
|
1402
|
+
extglob: true,
|
|
1403
|
+
value,
|
|
1404
|
+
output: ""
|
|
1405
|
+
});
|
|
1406
|
+
decrement("parens");
|
|
1407
|
+
return;
|
|
1408
|
+
}
|
|
1223
1409
|
let output = token.close + (opts.capture ? ")" : "");
|
|
1224
1410
|
let rest;
|
|
1225
1411
|
if (token.type === "negate") {
|
|
1226
1412
|
let extglobStar = star;
|
|
1227
1413
|
if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
|
|
1228
1414
|
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
|
|
1229
|
-
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) output = token.close = `)${parse
|
|
1415
|
+
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) output = token.close = `)${parse(rest, {
|
|
1230
1416
|
...options,
|
|
1231
1417
|
fastpaths: false
|
|
1232
1418
|
}).output})${extglobStar})`;
|
|
@@ -1251,11 +1437,11 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1251
1437
|
return m;
|
|
1252
1438
|
}
|
|
1253
1439
|
if (first === "?") {
|
|
1254
|
-
if (esc) return esc + first + (rest ? QMARK
|
|
1255
|
-
if (index === 0) return qmarkNoDot + (rest ? QMARK
|
|
1256
|
-
return QMARK
|
|
1440
|
+
if (esc) return esc + first + (rest ? QMARK.repeat(rest.length) : "");
|
|
1441
|
+
if (index === 0) return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
|
|
1442
|
+
return QMARK.repeat(chars.length);
|
|
1257
1443
|
}
|
|
1258
|
-
if (first === ".") return DOT_LITERAL
|
|
1444
|
+
if (first === ".") return DOT_LITERAL.repeat(chars.length);
|
|
1259
1445
|
if (first === "*") {
|
|
1260
1446
|
if (esc) return esc + first + (rest ? star : "");
|
|
1261
1447
|
return star;
|
|
@@ -1270,7 +1456,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1270
1456
|
state.output = input;
|
|
1271
1457
|
return state;
|
|
1272
1458
|
}
|
|
1273
|
-
state.output = utils
|
|
1459
|
+
state.output = utils.wrapOutput(output, state, options);
|
|
1274
1460
|
return state;
|
|
1275
1461
|
}
|
|
1276
1462
|
/**
|
|
@@ -1323,12 +1509,12 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1323
1509
|
if (inner.includes(":")) {
|
|
1324
1510
|
const idx = prev.value.lastIndexOf("[");
|
|
1325
1511
|
const pre = prev.value.slice(0, idx);
|
|
1326
|
-
const posix
|
|
1327
|
-
if (posix
|
|
1328
|
-
prev.value = pre + posix
|
|
1512
|
+
const posix = POSIX_REGEX_SOURCE[prev.value.slice(idx + 2)];
|
|
1513
|
+
if (posix) {
|
|
1514
|
+
prev.value = pre + posix;
|
|
1329
1515
|
state.backtrack = true;
|
|
1330
1516
|
advance();
|
|
1331
|
-
if (!bos.output && tokens.indexOf(prev) === 1) bos.output = ONE_CHAR
|
|
1517
|
+
if (!bos.output && tokens.indexOf(prev) === 1) bos.output = ONE_CHAR;
|
|
1332
1518
|
continue;
|
|
1333
1519
|
}
|
|
1334
1520
|
}
|
|
@@ -1346,7 +1532,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1346
1532
|
* until we reach the closing double quote.
|
|
1347
1533
|
*/
|
|
1348
1534
|
if (state.quotes === 1 && value !== "\"") {
|
|
1349
|
-
value = utils
|
|
1535
|
+
value = utils.escapeRegex(value);
|
|
1350
1536
|
prev.value += value;
|
|
1351
1537
|
append({ value });
|
|
1352
1538
|
continue;
|
|
@@ -1425,8 +1611,8 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1425
1611
|
if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) value = `/${value}`;
|
|
1426
1612
|
prev.value += value;
|
|
1427
1613
|
append({ value });
|
|
1428
|
-
if (opts.literalBrackets === false || utils
|
|
1429
|
-
const escaped = utils
|
|
1614
|
+
if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) continue;
|
|
1615
|
+
const escaped = utils.escapeRegex(prev.value);
|
|
1430
1616
|
state.output = state.output.slice(0, -prev.value.length);
|
|
1431
1617
|
if (opts.literalBrackets === true) {
|
|
1432
1618
|
state.output += escaped;
|
|
@@ -1535,7 +1721,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1535
1721
|
push({
|
|
1536
1722
|
type: "slash",
|
|
1537
1723
|
value,
|
|
1538
|
-
output: SLASH_LITERAL
|
|
1724
|
+
output: SLASH_LITERAL
|
|
1539
1725
|
});
|
|
1540
1726
|
continue;
|
|
1541
1727
|
}
|
|
@@ -1544,7 +1730,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1544
1730
|
*/
|
|
1545
1731
|
if (value === ".") {
|
|
1546
1732
|
if (state.braces > 0 && prev.type === "dot") {
|
|
1547
|
-
if (prev.value === ".") prev.output = DOT_LITERAL
|
|
1733
|
+
if (prev.value === ".") prev.output = DOT_LITERAL;
|
|
1548
1734
|
const brace = braces[braces.length - 1];
|
|
1549
1735
|
prev.type = "dots";
|
|
1550
1736
|
prev.output += value;
|
|
@@ -1556,14 +1742,14 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1556
1742
|
push({
|
|
1557
1743
|
type: "text",
|
|
1558
1744
|
value,
|
|
1559
|
-
output: DOT_LITERAL
|
|
1745
|
+
output: DOT_LITERAL
|
|
1560
1746
|
});
|
|
1561
1747
|
continue;
|
|
1562
1748
|
}
|
|
1563
1749
|
push({
|
|
1564
1750
|
type: "dot",
|
|
1565
1751
|
value,
|
|
1566
|
-
output: DOT_LITERAL
|
|
1752
|
+
output: DOT_LITERAL
|
|
1567
1753
|
});
|
|
1568
1754
|
continue;
|
|
1569
1755
|
}
|
|
@@ -1597,7 +1783,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1597
1783
|
push({
|
|
1598
1784
|
type: "qmark",
|
|
1599
1785
|
value,
|
|
1600
|
-
output: QMARK
|
|
1786
|
+
output: QMARK
|
|
1601
1787
|
});
|
|
1602
1788
|
continue;
|
|
1603
1789
|
}
|
|
@@ -1628,7 +1814,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1628
1814
|
push({
|
|
1629
1815
|
type: "plus",
|
|
1630
1816
|
value,
|
|
1631
|
-
output: PLUS_LITERAL
|
|
1817
|
+
output: PLUS_LITERAL
|
|
1632
1818
|
});
|
|
1633
1819
|
continue;
|
|
1634
1820
|
}
|
|
@@ -1641,7 +1827,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1641
1827
|
}
|
|
1642
1828
|
push({
|
|
1643
1829
|
type: "plus",
|
|
1644
|
-
value: PLUS_LITERAL
|
|
1830
|
+
value: PLUS_LITERAL
|
|
1645
1831
|
});
|
|
1646
1832
|
continue;
|
|
1647
1833
|
}
|
|
@@ -1756,7 +1942,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1756
1942
|
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
1757
1943
|
prior.output = `(?:${prior.output}`;
|
|
1758
1944
|
prev.type = "globstar";
|
|
1759
|
-
prev.output = `${globstar(opts)}${SLASH_LITERAL
|
|
1945
|
+
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
1760
1946
|
prev.value += value;
|
|
1761
1947
|
state.output += prior.output + prev.output;
|
|
1762
1948
|
state.globstar = true;
|
|
@@ -1771,7 +1957,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1771
1957
|
if (prior.type === "bos" && rest[0] === "/") {
|
|
1772
1958
|
prev.type = "globstar";
|
|
1773
1959
|
prev.value += value;
|
|
1774
|
-
prev.output = `(?:^|${SLASH_LITERAL
|
|
1960
|
+
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
1775
1961
|
state.output = prev.output;
|
|
1776
1962
|
state.globstar = true;
|
|
1777
1963
|
consume(value + advance());
|
|
@@ -1819,31 +2005,31 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1819
2005
|
prev.output += nodot;
|
|
1820
2006
|
}
|
|
1821
2007
|
if (peek() !== "*") {
|
|
1822
|
-
state.output += ONE_CHAR
|
|
1823
|
-
prev.output += ONE_CHAR
|
|
2008
|
+
state.output += ONE_CHAR;
|
|
2009
|
+
prev.output += ONE_CHAR;
|
|
1824
2010
|
}
|
|
1825
2011
|
}
|
|
1826
2012
|
push(token);
|
|
1827
2013
|
}
|
|
1828
2014
|
while (state.brackets > 0) {
|
|
1829
2015
|
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
|
|
1830
|
-
state.output = utils
|
|
2016
|
+
state.output = utils.escapeLast(state.output, "[");
|
|
1831
2017
|
decrement("brackets");
|
|
1832
2018
|
}
|
|
1833
2019
|
while (state.parens > 0) {
|
|
1834
2020
|
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
|
|
1835
|
-
state.output = utils
|
|
2021
|
+
state.output = utils.escapeLast(state.output, "(");
|
|
1836
2022
|
decrement("parens");
|
|
1837
2023
|
}
|
|
1838
2024
|
while (state.braces > 0) {
|
|
1839
2025
|
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
|
|
1840
|
-
state.output = utils
|
|
2026
|
+
state.output = utils.escapeLast(state.output, "{");
|
|
1841
2027
|
decrement("braces");
|
|
1842
2028
|
}
|
|
1843
2029
|
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) push({
|
|
1844
2030
|
type: "maybe_slash",
|
|
1845
2031
|
value: "",
|
|
1846
|
-
output: `${SLASH_LITERAL
|
|
2032
|
+
output: `${SLASH_LITERAL}?`
|
|
1847
2033
|
});
|
|
1848
2034
|
if (state.backtrack === true) {
|
|
1849
2035
|
state.output = "";
|
|
@@ -1859,13 +2045,13 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1859
2045
|
* This can significantly speed up processing and has very little downside
|
|
1860
2046
|
* impact when none of the fast paths match.
|
|
1861
2047
|
*/
|
|
1862
|
-
parse
|
|
2048
|
+
parse.fastpaths = (input, options) => {
|
|
1863
2049
|
const opts = { ...options };
|
|
1864
2050
|
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
1865
2051
|
const len = input.length;
|
|
1866
2052
|
if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
1867
2053
|
input = REPLACEMENTS[input] || input;
|
|
1868
|
-
const { DOT_LITERAL
|
|
2054
|
+
const { DOT_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR } = constants.globChars(opts.windows);
|
|
1869
2055
|
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
1870
2056
|
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
1871
2057
|
const capture = opts.capture ? "" : "?:";
|
|
@@ -1875,42 +2061,41 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1875
2061
|
};
|
|
1876
2062
|
let star = opts.bash === true ? ".*?" : STAR;
|
|
1877
2063
|
if (opts.capture) star = `(${star})`;
|
|
1878
|
-
const globstar = (opts
|
|
1879
|
-
if (opts
|
|
1880
|
-
return `(${capture}(?:(?!${START_ANCHOR
|
|
2064
|
+
const globstar = (opts) => {
|
|
2065
|
+
if (opts.noglobstar === true) return star;
|
|
2066
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
1881
2067
|
};
|
|
1882
2068
|
const create = (str) => {
|
|
1883
2069
|
switch (str) {
|
|
1884
|
-
case "*": return `${nodot}${ONE_CHAR
|
|
1885
|
-
case ".*": return `${DOT_LITERAL
|
|
1886
|
-
case "*.*": return `${nodot}${star}${DOT_LITERAL
|
|
1887
|
-
case "*/*": return `${nodot}${star}${SLASH_LITERAL
|
|
2070
|
+
case "*": return `${nodot}${ONE_CHAR}${star}`;
|
|
2071
|
+
case ".*": return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2072
|
+
case "*.*": return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2073
|
+
case "*/*": return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
1888
2074
|
case "**": return nodot + globstar(opts);
|
|
1889
|
-
case "**/*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL
|
|
1890
|
-
case "**/*.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL
|
|
1891
|
-
case "**/.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL
|
|
2075
|
+
case "**/*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
2076
|
+
case "**/*.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2077
|
+
case "**/.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1892
2078
|
default: {
|
|
1893
2079
|
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
1894
2080
|
if (!match) return;
|
|
1895
|
-
const source
|
|
1896
|
-
if (!source
|
|
1897
|
-
return source
|
|
2081
|
+
const source = create(match[1]);
|
|
2082
|
+
if (!source) return;
|
|
2083
|
+
return source + DOT_LITERAL + match[2];
|
|
1898
2084
|
}
|
|
1899
2085
|
}
|
|
1900
2086
|
};
|
|
1901
|
-
let source = create(utils
|
|
1902
|
-
if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL
|
|
2087
|
+
let source = create(utils.removePrefix(input, state));
|
|
2088
|
+
if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL}?`;
|
|
1903
2089
|
return source;
|
|
1904
2090
|
};
|
|
1905
|
-
module.exports = parse
|
|
2091
|
+
module.exports = parse;
|
|
1906
2092
|
}));
|
|
1907
|
-
|
|
1908
2093
|
//#endregion
|
|
1909
|
-
//#region ../../node_modules/.bun/picomatch@4.0.
|
|
2094
|
+
//#region ../../node_modules/.bun/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
|
|
1910
2095
|
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1911
2096
|
const scan = require_scan();
|
|
1912
2097
|
const parse = require_parse();
|
|
1913
|
-
const utils
|
|
2098
|
+
const utils = require_utils();
|
|
1914
2099
|
const constants = require_constants();
|
|
1915
2100
|
const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
1916
2101
|
/**
|
|
@@ -1934,23 +2119,23 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1934
2119
|
* @return {Function=} Returns a matcher function.
|
|
1935
2120
|
* @api public
|
|
1936
2121
|
*/
|
|
1937
|
-
const picomatch
|
|
1938
|
-
if (Array.isArray(glob
|
|
1939
|
-
const fns = glob
|
|
2122
|
+
const picomatch = (glob, options, returnState = false) => {
|
|
2123
|
+
if (Array.isArray(glob)) {
|
|
2124
|
+
const fns = glob.map((input) => picomatch(input, options, returnState));
|
|
1940
2125
|
const arrayMatcher = (str) => {
|
|
1941
2126
|
for (const isMatch of fns) {
|
|
1942
|
-
const state
|
|
1943
|
-
if (state
|
|
2127
|
+
const state = isMatch(str);
|
|
2128
|
+
if (state) return state;
|
|
1944
2129
|
}
|
|
1945
2130
|
return false;
|
|
1946
2131
|
};
|
|
1947
2132
|
return arrayMatcher;
|
|
1948
2133
|
}
|
|
1949
|
-
const isState = isObject(glob
|
|
1950
|
-
if (glob
|
|
2134
|
+
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
2135
|
+
if (glob === "" || typeof glob !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
|
|
1951
2136
|
const opts = options || {};
|
|
1952
|
-
const posix
|
|
1953
|
-
const regex = isState ? picomatch
|
|
2137
|
+
const posix = opts.windows;
|
|
2138
|
+
const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
|
|
1954
2139
|
const state = regex.state;
|
|
1955
2140
|
delete regex.state;
|
|
1956
2141
|
let isIgnored = () => false;
|
|
@@ -1961,18 +2146,18 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1961
2146
|
onMatch: null,
|
|
1962
2147
|
onResult: null
|
|
1963
2148
|
};
|
|
1964
|
-
isIgnored = picomatch
|
|
2149
|
+
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
1965
2150
|
}
|
|
1966
2151
|
const matcher = (input, returnObject = false) => {
|
|
1967
|
-
const { isMatch, match, output } = picomatch
|
|
1968
|
-
glob
|
|
1969
|
-
posix
|
|
2152
|
+
const { isMatch, match, output } = picomatch.test(input, regex, options, {
|
|
2153
|
+
glob,
|
|
2154
|
+
posix
|
|
1970
2155
|
});
|
|
1971
2156
|
const result = {
|
|
1972
|
-
glob
|
|
2157
|
+
glob,
|
|
1973
2158
|
state,
|
|
1974
2159
|
regex,
|
|
1975
|
-
posix
|
|
2160
|
+
posix,
|
|
1976
2161
|
input,
|
|
1977
2162
|
output,
|
|
1978
2163
|
match,
|
|
@@ -2010,21 +2195,21 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2010
2195
|
* @return {Object} Returns an object with matching info.
|
|
2011
2196
|
* @api public
|
|
2012
2197
|
*/
|
|
2013
|
-
picomatch
|
|
2198
|
+
picomatch.test = (input, regex, options, { glob, posix } = {}) => {
|
|
2014
2199
|
if (typeof input !== "string") throw new TypeError("Expected input to be a string");
|
|
2015
2200
|
if (input === "") return {
|
|
2016
2201
|
isMatch: false,
|
|
2017
2202
|
output: ""
|
|
2018
2203
|
};
|
|
2019
2204
|
const opts = options || {};
|
|
2020
|
-
const format = opts.format || (posix
|
|
2021
|
-
let match = input === glob
|
|
2205
|
+
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
2206
|
+
let match = input === glob;
|
|
2022
2207
|
let output = match && format ? format(input) : input;
|
|
2023
2208
|
if (match === false) {
|
|
2024
2209
|
output = format ? format(input) : input;
|
|
2025
|
-
match = output === glob
|
|
2210
|
+
match = output === glob;
|
|
2026
2211
|
}
|
|
2027
|
-
if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch
|
|
2212
|
+
if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch.matchBase(input, regex, options, posix);
|
|
2028
2213
|
else match = regex.exec(output);
|
|
2029
2214
|
return {
|
|
2030
2215
|
isMatch: Boolean(match),
|
|
@@ -2045,8 +2230,8 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2045
2230
|
* @return {Boolean}
|
|
2046
2231
|
* @api public
|
|
2047
2232
|
*/
|
|
2048
|
-
picomatch
|
|
2049
|
-
return (glob
|
|
2233
|
+
picomatch.matchBase = (input, glob, options) => {
|
|
2234
|
+
return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(utils.basename(input));
|
|
2050
2235
|
};
|
|
2051
2236
|
/**
|
|
2052
2237
|
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
|
@@ -2064,7 +2249,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2064
2249
|
* @return {Boolean} Returns true if any patterns match `str`
|
|
2065
2250
|
* @api public
|
|
2066
2251
|
*/
|
|
2067
|
-
picomatch
|
|
2252
|
+
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
2068
2253
|
/**
|
|
2069
2254
|
* Parse a glob pattern to create the source string for a regular
|
|
2070
2255
|
* expression.
|
|
@@ -2078,8 +2263,8 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2078
2263
|
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
|
|
2079
2264
|
* @api public
|
|
2080
2265
|
*/
|
|
2081
|
-
picomatch
|
|
2082
|
-
if (Array.isArray(pattern)) return pattern.map((p) => picomatch
|
|
2266
|
+
picomatch.parse = (pattern, options) => {
|
|
2267
|
+
if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
|
|
2083
2268
|
return parse(pattern, {
|
|
2084
2269
|
...options,
|
|
2085
2270
|
fastpaths: false
|
|
@@ -2111,11 +2296,19 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2111
2296
|
* @return {Object} Returns an object with
|
|
2112
2297
|
* @api public
|
|
2113
2298
|
*/
|
|
2114
|
-
picomatch
|
|
2299
|
+
picomatch.scan = (input, options) => scan(input, options);
|
|
2115
2300
|
/**
|
|
2116
2301
|
* Compile a regular expression from the `state` object returned by the
|
|
2117
2302
|
* [parse()](#parse) method.
|
|
2118
2303
|
*
|
|
2304
|
+
* ```js
|
|
2305
|
+
* const picomatch = require('picomatch');
|
|
2306
|
+
* const state = picomatch.parse('*.js');
|
|
2307
|
+
* // picomatch.compileRe(state[, options]);
|
|
2308
|
+
*
|
|
2309
|
+
* console.log(picomatch.compileRe(state));
|
|
2310
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
2311
|
+
* ```
|
|
2119
2312
|
* @param {Object} `state`
|
|
2120
2313
|
* @param {Object} `options`
|
|
2121
2314
|
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
@@ -2123,14 +2316,14 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2123
2316
|
* @return {RegExp}
|
|
2124
2317
|
* @api public
|
|
2125
2318
|
*/
|
|
2126
|
-
picomatch
|
|
2319
|
+
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
2127
2320
|
if (returnOutput === true) return state.output;
|
|
2128
2321
|
const opts = options || {};
|
|
2129
2322
|
const prepend = opts.contains ? "" : "^";
|
|
2130
2323
|
const append = opts.contains ? "" : "$";
|
|
2131
2324
|
let source = `${prepend}(?:${state.output})${append}`;
|
|
2132
2325
|
if (state && state.negated === true) source = `^(?!${source}).*$`;
|
|
2133
|
-
const regex = picomatch
|
|
2326
|
+
const regex = picomatch.toRegex(source, options);
|
|
2134
2327
|
if (returnState === true) regex.state = state;
|
|
2135
2328
|
return regex;
|
|
2136
2329
|
};
|
|
@@ -2139,10 +2332,10 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2139
2332
|
*
|
|
2140
2333
|
* ```js
|
|
2141
2334
|
* const picomatch = require('picomatch');
|
|
2142
|
-
*
|
|
2143
|
-
* // picomatch.compileRe(state[, options]);
|
|
2335
|
+
* // picomatch.makeRe(state[, options]);
|
|
2144
2336
|
*
|
|
2145
|
-
*
|
|
2337
|
+
* const result = picomatch.makeRe('*.js');
|
|
2338
|
+
* console.log(result);
|
|
2146
2339
|
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
2147
2340
|
* ```
|
|
2148
2341
|
* @param {String} `state` The object returned from the `.parse` method.
|
|
@@ -2152,7 +2345,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2152
2345
|
* @return {RegExp} Returns a regex created from the given pattern.
|
|
2153
2346
|
* @api public
|
|
2154
2347
|
*/
|
|
2155
|
-
picomatch
|
|
2348
|
+
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
2156
2349
|
if (!input || typeof input !== "string") throw new TypeError("Expected a non-empty string");
|
|
2157
2350
|
let parsed = {
|
|
2158
2351
|
negated: false,
|
|
@@ -2160,7 +2353,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2160
2353
|
};
|
|
2161
2354
|
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse.fastpaths(input, options);
|
|
2162
2355
|
if (!parsed.output) parsed = parse(input, options);
|
|
2163
|
-
return picomatch
|
|
2356
|
+
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
2164
2357
|
};
|
|
2165
2358
|
/**
|
|
2166
2359
|
* Create a regular expression from the given regex source string.
|
|
@@ -2178,7 +2371,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2178
2371
|
* @return {RegExp}
|
|
2179
2372
|
* @api public
|
|
2180
2373
|
*/
|
|
2181
|
-
picomatch
|
|
2374
|
+
picomatch.toRegex = (source, options) => {
|
|
2182
2375
|
try {
|
|
2183
2376
|
const opts = options || {};
|
|
2184
2377
|
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
|
@@ -2191,62 +2384,58 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2191
2384
|
* Picomatch constants.
|
|
2192
2385
|
* @return {Object}
|
|
2193
2386
|
*/
|
|
2194
|
-
picomatch
|
|
2387
|
+
picomatch.constants = constants;
|
|
2195
2388
|
/**
|
|
2196
2389
|
* Expose "picomatch"
|
|
2197
2390
|
*/
|
|
2198
|
-
module.exports = picomatch
|
|
2391
|
+
module.exports = picomatch;
|
|
2199
2392
|
}));
|
|
2200
|
-
|
|
2201
2393
|
//#endregion
|
|
2202
|
-
//#region ../../node_modules/.bun/
|
|
2203
|
-
var
|
|
2394
|
+
//#region ../../node_modules/.bun/tinyglobby@0.2.16/node_modules/tinyglobby/dist/index.mjs
|
|
2395
|
+
var import_picomatch = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2204
2396
|
const pico = require_picomatch$1();
|
|
2205
2397
|
const utils = require_utils();
|
|
2206
|
-
function picomatch
|
|
2398
|
+
function picomatch(glob, options, returnState = false) {
|
|
2207
2399
|
if (options && (options.windows === null || options.windows === void 0)) options = {
|
|
2208
2400
|
...options,
|
|
2209
2401
|
windows: utils.isWindows()
|
|
2210
2402
|
};
|
|
2211
|
-
return pico(glob
|
|
2403
|
+
return pico(glob, options, returnState);
|
|
2212
2404
|
}
|
|
2213
|
-
Object.assign(picomatch
|
|
2214
|
-
module.exports = picomatch
|
|
2215
|
-
}));
|
|
2216
|
-
|
|
2217
|
-
//#endregion
|
|
2218
|
-
//#region ../../node_modules/.bun/tinyglobby@0.2.15/node_modules/tinyglobby/dist/index.mjs
|
|
2219
|
-
var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch(), 1);
|
|
2405
|
+
Object.assign(picomatch, pico);
|
|
2406
|
+
module.exports = picomatch;
|
|
2407
|
+
})))(), 1);
|
|
2220
2408
|
const isReadonlyArray = Array.isArray;
|
|
2409
|
+
const BACKSLASHES = /\\/g;
|
|
2221
2410
|
const isWin = process.platform === "win32";
|
|
2222
2411
|
const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
2223
2412
|
function getPartialMatcher(patterns, options = {}) {
|
|
2224
2413
|
const patternsCount = patterns.length;
|
|
2225
2414
|
const patternsParts = Array(patternsCount);
|
|
2226
2415
|
const matchers = Array(patternsCount);
|
|
2227
|
-
|
|
2228
|
-
for (
|
|
2416
|
+
let i, j;
|
|
2417
|
+
for (i = 0; i < patternsCount; i++) {
|
|
2229
2418
|
const parts = splitPattern(patterns[i]);
|
|
2230
2419
|
patternsParts[i] = parts;
|
|
2231
2420
|
const partsCount = parts.length;
|
|
2232
2421
|
const partMatchers = Array(partsCount);
|
|
2233
|
-
for (
|
|
2422
|
+
for (j = 0; j < partsCount; j++) partMatchers[j] = (0, import_picomatch.default)(parts[j], options);
|
|
2234
2423
|
matchers[i] = partMatchers;
|
|
2235
2424
|
}
|
|
2236
2425
|
return (input) => {
|
|
2237
2426
|
const inputParts = input.split("/");
|
|
2238
2427
|
if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
|
|
2239
|
-
for (
|
|
2428
|
+
for (i = 0; i < patternsCount; i++) {
|
|
2240
2429
|
const patternParts = patternsParts[i];
|
|
2241
2430
|
const matcher = matchers[i];
|
|
2242
2431
|
const inputPatternCount = inputParts.length;
|
|
2243
2432
|
const minParts = Math.min(inputPatternCount, patternParts.length);
|
|
2244
|
-
|
|
2433
|
+
j = 0;
|
|
2245
2434
|
while (j < minParts) {
|
|
2246
2435
|
const part = patternParts[j];
|
|
2247
2436
|
if (part.includes("/")) return true;
|
|
2248
2437
|
if (!matcher[j](inputParts[j])) break;
|
|
2249
|
-
if (
|
|
2438
|
+
if (!options.noglobstar && part === "**") return true;
|
|
2250
2439
|
j++;
|
|
2251
2440
|
}
|
|
2252
2441
|
if (j === inputPatternCount) return true;
|
|
@@ -2260,7 +2449,7 @@ const isRoot = isWin ? (p) => WIN32_ROOT_DIR.test(p) : (p) => p === "/";
|
|
|
2260
2449
|
function buildFormat(cwd, root, absolute) {
|
|
2261
2450
|
if (cwd === root || root.startsWith(`${cwd}/`)) {
|
|
2262
2451
|
if (absolute) {
|
|
2263
|
-
const start =
|
|
2452
|
+
const start = cwd.length + +!isRoot(cwd);
|
|
2264
2453
|
return (p, isDir) => p.slice(start, isDir ? -1 : void 0) || ".";
|
|
2265
2454
|
}
|
|
2266
2455
|
const prefix = root.slice(cwd.length + 1);
|
|
@@ -2281,20 +2470,19 @@ function buildRelative(cwd, root) {
|
|
|
2281
2470
|
}
|
|
2282
2471
|
return (p) => {
|
|
2283
2472
|
const result = posix.relative(cwd, `${root}/${p}`);
|
|
2284
|
-
|
|
2285
|
-
return result || ".";
|
|
2473
|
+
return p[p.length - 1] === "/" && result !== "" ? `${result}/` : result || ".";
|
|
2286
2474
|
};
|
|
2287
2475
|
}
|
|
2288
2476
|
const splitPatternOptions = { parts: true };
|
|
2289
|
-
function splitPattern(path
|
|
2477
|
+
function splitPattern(path) {
|
|
2290
2478
|
var _result$parts;
|
|
2291
|
-
const result = import_picomatch.default.scan(path
|
|
2292
|
-
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path
|
|
2479
|
+
const result = import_picomatch.default.scan(path, splitPatternOptions);
|
|
2480
|
+
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path];
|
|
2293
2481
|
}
|
|
2294
2482
|
const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
|
|
2295
2483
|
const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
2296
|
-
const escapePosixPath = (path
|
|
2297
|
-
const escapeWin32Path = (path
|
|
2484
|
+
const escapePosixPath = (path) => path.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
2485
|
+
const escapeWin32Path = (path) => path.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
2298
2486
|
/**
|
|
2299
2487
|
* Escapes a path's special characters depending on the platform.
|
|
2300
2488
|
* @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
|
|
@@ -2315,34 +2503,37 @@ const escapePath = isWin ? escapeWin32Path : escapePosixPath;
|
|
|
2315
2503
|
*/
|
|
2316
2504
|
function isDynamicPattern(pattern, options) {
|
|
2317
2505
|
if ((options === null || options === void 0 ? void 0 : options.caseSensitiveMatch) === false) return true;
|
|
2318
|
-
const scan
|
|
2319
|
-
return scan
|
|
2506
|
+
const scan = import_picomatch.default.scan(pattern);
|
|
2507
|
+
return scan.isGlob || scan.negated;
|
|
2320
2508
|
}
|
|
2321
2509
|
function log(...tasks) {
|
|
2322
2510
|
console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
|
|
2323
2511
|
}
|
|
2512
|
+
function ensureStringArray(value) {
|
|
2513
|
+
return typeof value === "string" ? [value] : value !== null && value !== void 0 ? value : [];
|
|
2514
|
+
}
|
|
2324
2515
|
const PARENT_DIRECTORY = /^(\/?\.\.)+/;
|
|
2325
2516
|
const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
|
|
2326
|
-
|
|
2327
|
-
|
|
2517
|
+
function normalizePattern(pattern, opts, props, isIgnore) {
|
|
2518
|
+
var _PARENT_DIRECTORY$exe;
|
|
2519
|
+
const cwd = opts.cwd;
|
|
2328
2520
|
let result = pattern;
|
|
2329
|
-
if (pattern.
|
|
2330
|
-
if (
|
|
2521
|
+
if (pattern[pattern.length - 1] === "/") result = pattern.slice(0, -1);
|
|
2522
|
+
if (result[result.length - 1] !== "*" && opts.expandDirectories) result += "/**";
|
|
2331
2523
|
const escapedCwd = escapePath(cwd);
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
|
|
2524
|
+
result = isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")) ? posix.relative(escapedCwd, result) : posix.normalize(result);
|
|
2525
|
+
const parentDir = (_PARENT_DIRECTORY$exe = PARENT_DIRECTORY.exec(result)) === null || _PARENT_DIRECTORY$exe === void 0 ? void 0 : _PARENT_DIRECTORY$exe[0];
|
|
2335
2526
|
const parts = splitPattern(result);
|
|
2336
|
-
if (
|
|
2337
|
-
const n = (
|
|
2527
|
+
if (parentDir) {
|
|
2528
|
+
const n = (parentDir.length + 1) / 3;
|
|
2338
2529
|
let i = 0;
|
|
2339
2530
|
const cwdParts = escapedCwd.split("/");
|
|
2340
2531
|
while (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {
|
|
2341
2532
|
result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
|
|
2342
2533
|
i++;
|
|
2343
2534
|
}
|
|
2344
|
-
const potentialRoot = posix.join(cwd,
|
|
2345
|
-
if (
|
|
2535
|
+
const potentialRoot = posix.join(cwd, parentDir.slice(i * 3));
|
|
2536
|
+
if (potentialRoot[0] !== "." && props.root.length > potentialRoot.length) {
|
|
2346
2537
|
props.root = potentialRoot;
|
|
2347
2538
|
props.depthOffset = -n + i;
|
|
2348
2539
|
}
|
|
@@ -2358,7 +2549,7 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
|
|
|
2358
2549
|
newCommonPath.pop();
|
|
2359
2550
|
break;
|
|
2360
2551
|
}
|
|
2361
|
-
if (part !== props.commonPath[i] || isDynamicPattern(part)
|
|
2552
|
+
if (i === parts.length - 1 || part !== props.commonPath[i] || isDynamicPattern(part)) break;
|
|
2362
2553
|
newCommonPath.push(part);
|
|
2363
2554
|
}
|
|
2364
2555
|
props.depthOffset = newCommonPath.length;
|
|
@@ -2367,137 +2558,127 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
|
|
|
2367
2558
|
}
|
|
2368
2559
|
return result;
|
|
2369
2560
|
}
|
|
2370
|
-
function processPatterns(
|
|
2371
|
-
if (typeof patterns === "string") patterns = [patterns];
|
|
2372
|
-
if (typeof ignore === "string") ignore = [ignore];
|
|
2561
|
+
function processPatterns(options, patterns, props) {
|
|
2373
2562
|
const matchPatterns = [];
|
|
2374
2563
|
const ignorePatterns = [];
|
|
2375
|
-
for (const pattern of ignore) {
|
|
2564
|
+
for (const pattern of options.ignore) {
|
|
2376
2565
|
if (!pattern) continue;
|
|
2377
|
-
if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern,
|
|
2566
|
+
if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, options, props, true));
|
|
2378
2567
|
}
|
|
2379
2568
|
for (const pattern of patterns) {
|
|
2380
2569
|
if (!pattern) continue;
|
|
2381
|
-
if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern,
|
|
2382
|
-
else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1),
|
|
2570
|
+
if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern, options, props, false));
|
|
2571
|
+
else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), options, props, true));
|
|
2383
2572
|
}
|
|
2384
2573
|
return {
|
|
2385
2574
|
match: matchPatterns,
|
|
2386
2575
|
ignore: ignorePatterns
|
|
2387
2576
|
};
|
|
2388
2577
|
}
|
|
2389
|
-
function
|
|
2390
|
-
|
|
2391
|
-
const path$1 = paths[i];
|
|
2392
|
-
paths[i] = relative$1(path$1);
|
|
2393
|
-
}
|
|
2394
|
-
return paths;
|
|
2395
|
-
}
|
|
2396
|
-
function normalizeCwd(cwd) {
|
|
2397
|
-
if (!cwd) return process.cwd().replace(BACKSLASHES, "/");
|
|
2398
|
-
if (cwd instanceof URL) return fileURLToPath$1(cwd).replace(BACKSLASHES, "/");
|
|
2399
|
-
return path.resolve(cwd).replace(BACKSLASHES, "/");
|
|
2400
|
-
}
|
|
2401
|
-
function getCrawler(patterns, inputOptions = {}) {
|
|
2402
|
-
const options = process.env.TINYGLOBBY_DEBUG ? {
|
|
2403
|
-
...inputOptions,
|
|
2404
|
-
debug: true
|
|
2405
|
-
} : inputOptions;
|
|
2406
|
-
const cwd = normalizeCwd(options.cwd);
|
|
2407
|
-
if (options.debug) log("globbing with:", {
|
|
2408
|
-
patterns,
|
|
2409
|
-
options,
|
|
2410
|
-
cwd
|
|
2411
|
-
});
|
|
2412
|
-
if (Array.isArray(patterns) && patterns.length === 0) return [{
|
|
2413
|
-
sync: () => [],
|
|
2414
|
-
withPromise: async () => []
|
|
2415
|
-
}, false];
|
|
2578
|
+
function buildCrawler(options, patterns) {
|
|
2579
|
+
const cwd = options.cwd;
|
|
2416
2580
|
const props = {
|
|
2417
2581
|
root: cwd,
|
|
2418
|
-
commonPath: null,
|
|
2419
2582
|
depthOffset: 0
|
|
2420
2583
|
};
|
|
2421
|
-
const processed = processPatterns(
|
|
2422
|
-
...options,
|
|
2423
|
-
patterns
|
|
2424
|
-
}, cwd, props);
|
|
2584
|
+
const processed = processPatterns(options, patterns, props);
|
|
2425
2585
|
if (options.debug) log("internal processing patterns:", processed);
|
|
2586
|
+
const { absolute, caseSensitiveMatch, debug, dot, followSymbolicLinks, onlyDirectories } = options;
|
|
2587
|
+
const root = props.root.replace(BACKSLASHES, "");
|
|
2426
2588
|
const matchOptions = {
|
|
2427
|
-
dot
|
|
2589
|
+
dot,
|
|
2428
2590
|
nobrace: options.braceExpansion === false,
|
|
2429
|
-
nocase:
|
|
2591
|
+
nocase: !caseSensitiveMatch,
|
|
2430
2592
|
noextglob: options.extglob === false,
|
|
2431
2593
|
noglobstar: options.globstar === false,
|
|
2432
2594
|
posix: true
|
|
2433
2595
|
};
|
|
2434
|
-
const matcher = (0, import_picomatch.default)(processed.match,
|
|
2435
|
-
...matchOptions,
|
|
2436
|
-
ignore: processed.ignore
|
|
2437
|
-
});
|
|
2596
|
+
const matcher = (0, import_picomatch.default)(processed.match, matchOptions);
|
|
2438
2597
|
const ignore = (0, import_picomatch.default)(processed.ignore, matchOptions);
|
|
2439
2598
|
const partialMatcher = getPartialMatcher(processed.match, matchOptions);
|
|
2440
|
-
const format = buildFormat(cwd,
|
|
2441
|
-
const
|
|
2442
|
-
const
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2599
|
+
const format = buildFormat(cwd, root, absolute);
|
|
2600
|
+
const excludeFormatter = absolute ? format : buildFormat(cwd, root, true);
|
|
2601
|
+
const excludePredicate = (_, p) => {
|
|
2602
|
+
const relativePath = excludeFormatter(p, true);
|
|
2603
|
+
return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
|
|
2604
|
+
};
|
|
2605
|
+
let maxDepth;
|
|
2606
|
+
if (options.deep !== void 0) maxDepth = Math.round(options.deep - props.depthOffset);
|
|
2607
|
+
const crawler = new Builder({
|
|
2608
|
+
filters: [debug ? (p, isDirectory) => {
|
|
2609
|
+
const path = format(p, isDirectory);
|
|
2610
|
+
const matches = matcher(path) && !ignore(path);
|
|
2611
|
+
if (matches) log(`matched ${path}`);
|
|
2447
2612
|
return matches;
|
|
2448
|
-
} : (p, isDirectory) =>
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2613
|
+
} : (p, isDirectory) => {
|
|
2614
|
+
const path = format(p, isDirectory);
|
|
2615
|
+
return matcher(path) && !ignore(path);
|
|
2616
|
+
}],
|
|
2617
|
+
exclude: debug ? (_, p) => {
|
|
2618
|
+
const skipped = excludePredicate(_, p);
|
|
2619
|
+
log(`${skipped ? "skipped" : "crawling"} ${p}`);
|
|
2454
2620
|
return skipped;
|
|
2455
|
-
} :
|
|
2456
|
-
|
|
2457
|
-
return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
|
|
2458
|
-
},
|
|
2459
|
-
fs: options.fs ? {
|
|
2460
|
-
readdir: options.fs.readdir || nativeFs.readdir,
|
|
2461
|
-
readdirSync: options.fs.readdirSync || nativeFs.readdirSync,
|
|
2462
|
-
realpath: options.fs.realpath || nativeFs.realpath,
|
|
2463
|
-
realpathSync: options.fs.realpathSync || nativeFs.realpathSync,
|
|
2464
|
-
stat: options.fs.stat || nativeFs.stat,
|
|
2465
|
-
statSync: options.fs.statSync || nativeFs.statSync
|
|
2466
|
-
} : void 0,
|
|
2621
|
+
} : excludePredicate,
|
|
2622
|
+
fs: options.fs,
|
|
2467
2623
|
pathSeparator: "/",
|
|
2468
|
-
relativePaths:
|
|
2469
|
-
|
|
2624
|
+
relativePaths: !absolute,
|
|
2625
|
+
resolvePaths: absolute,
|
|
2626
|
+
includeBasePath: absolute,
|
|
2627
|
+
resolveSymlinks: followSymbolicLinks,
|
|
2628
|
+
excludeSymlinks: !followSymbolicLinks,
|
|
2629
|
+
excludeFiles: onlyDirectories,
|
|
2630
|
+
includeDirs: onlyDirectories || !options.onlyFiles,
|
|
2631
|
+
maxDepth,
|
|
2470
2632
|
signal: options.signal
|
|
2633
|
+
}).crawl(root);
|
|
2634
|
+
if (options.debug) log("internal properties:", {
|
|
2635
|
+
...props,
|
|
2636
|
+
root
|
|
2637
|
+
});
|
|
2638
|
+
return [crawler, cwd !== root && !absolute && buildRelative(cwd, root)];
|
|
2639
|
+
}
|
|
2640
|
+
function formatPaths(paths, mapper) {
|
|
2641
|
+
if (mapper) for (let i = paths.length - 1; i >= 0; i--) paths[i] = mapper(paths[i]);
|
|
2642
|
+
return paths;
|
|
2643
|
+
}
|
|
2644
|
+
const defaultOptions = {
|
|
2645
|
+
caseSensitiveMatch: true,
|
|
2646
|
+
cwd: process.cwd(),
|
|
2647
|
+
debug: !!process.env.TINYGLOBBY_DEBUG,
|
|
2648
|
+
expandDirectories: true,
|
|
2649
|
+
followSymbolicLinks: true,
|
|
2650
|
+
onlyFiles: true
|
|
2651
|
+
};
|
|
2652
|
+
function getOptions(options) {
|
|
2653
|
+
const opts = {
|
|
2654
|
+
...defaultOptions,
|
|
2655
|
+
...options
|
|
2471
2656
|
};
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
}
|
|
2482
|
-
if (
|
|
2483
|
-
|
|
2484
|
-
fdirOptions.includeDirs = true;
|
|
2485
|
-
} else if (options.onlyFiles === false) fdirOptions.includeDirs = true;
|
|
2486
|
-
props.root = props.root.replace(BACKSLASHES, "");
|
|
2487
|
-
const root = props.root;
|
|
2488
|
-
if (options.debug) log("internal properties:", props);
|
|
2489
|
-
const relative$1 = cwd !== root && !options.absolute && buildRelative(cwd, props.root);
|
|
2490
|
-
return [new Builder(fdirOptions).crawl(root), relative$1];
|
|
2657
|
+
opts.cwd = (opts.cwd instanceof URL ? fileURLToPath$1(opts.cwd) : resolve(opts.cwd)).replace(BACKSLASHES, "/");
|
|
2658
|
+
opts.ignore = ensureStringArray(opts.ignore);
|
|
2659
|
+
opts.fs && (opts.fs = {
|
|
2660
|
+
readdir: opts.fs.readdir || readdir,
|
|
2661
|
+
readdirSync: opts.fs.readdirSync || readdirSync,
|
|
2662
|
+
realpath: opts.fs.realpath || realpath,
|
|
2663
|
+
realpathSync: opts.fs.realpathSync || realpathSync,
|
|
2664
|
+
stat: opts.fs.stat || stat,
|
|
2665
|
+
statSync: opts.fs.statSync || statSync
|
|
2666
|
+
});
|
|
2667
|
+
if (opts.debug) log("globbing with options:", opts);
|
|
2668
|
+
return opts;
|
|
2491
2669
|
}
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
const
|
|
2496
|
-
const
|
|
2497
|
-
|
|
2498
|
-
return
|
|
2670
|
+
function getCrawler(globInput, inputOptions = {}) {
|
|
2671
|
+
var _ref;
|
|
2672
|
+
if (globInput && (inputOptions === null || inputOptions === void 0 ? void 0 : inputOptions.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
|
|
2673
|
+
const isModern = isReadonlyArray(globInput) || typeof globInput === "string";
|
|
2674
|
+
const patterns = ensureStringArray((_ref = isModern ? globInput : globInput.patterns) !== null && _ref !== void 0 ? _ref : "**/*");
|
|
2675
|
+
const options = getOptions(isModern ? inputOptions : globInput);
|
|
2676
|
+
return patterns.length > 0 ? buildCrawler(options, patterns) : [];
|
|
2677
|
+
}
|
|
2678
|
+
async function glob(globInput, options) {
|
|
2679
|
+
const [crawler, relative] = getCrawler(globInput, options);
|
|
2680
|
+
return crawler ? formatPaths(await crawler.withPromise(), relative) : [];
|
|
2499
2681
|
}
|
|
2500
|
-
|
|
2501
2682
|
//#endregion
|
|
2502
2683
|
//#region src/core/template-reader.ts
|
|
2503
2684
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -2558,7 +2739,7 @@ async function listTemplates(prefix) {
|
|
|
2558
2739
|
});
|
|
2559
2740
|
return prefix ? files.map((f) => `${prefix}/${f}`) : files;
|
|
2560
2741
|
}
|
|
2561
|
-
|
|
2562
2742
|
//#endregion
|
|
2563
2743
|
export { loadTemplates as a, loadTemplate as i, getTemplatesRoot as n, listTemplates as r, getBinaryTemplatesRoot as t };
|
|
2564
|
-
|
|
2744
|
+
|
|
2745
|
+
//# sourceMappingURL=template-reader-C8MBRmk-.mjs.map
|