@better-t-stack/template-generator 3.27.1 → 3.27.3

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.
@@ -1,32 +1,27 @@
1
- import { t as isBinaryPath } from "./is-binary-path-BN88l03c.mjs";
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$1 from "fs";
6
- import nativeFs from "fs";
7
- import path, { basename, dirname as dirname$1, normalize as normalize$1, posix, relative, resolve, sep } from "path";
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
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
22
- key = keys[i];
23
- if (!__hasOwnProp.call(to, key) && key !== except) {
24
- __defProp(to, key, {
25
- get: ((k) => from[k]).bind(null, key),
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+a185e370e160e74e/node_modules/fdir/dist/index.mjs
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$1) {
42
- let normalized = normalize$1(path$1);
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$1, separator) {
48
- return path$1.replace(SLASHES_REGEX, separator);
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$1) {
52
- return path$1 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path$1);
45
+ function isRootDirectory(path) {
46
+ return path === "/" || WINDOWS_ROOT_DIR_REGEX.test(path);
53
47
  }
54
- function normalizePath(path$1, options) {
48
+ function normalizePath(path, options) {
55
49
  const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
56
- const pathNeedsCleaning = process.platform === "win32" && path$1.includes("/") || path$1.startsWith(".");
57
- if (resolvePaths) path$1 = resolve(path$1);
58
- if (normalizePath$1 || pathNeedsCleaning) path$1 = cleanPath(path$1);
59
- if (path$1 === ".") return "";
60
- return convertSlashes(path$1[path$1.length - 1] !== pathSeparator ? path$1 + pathSeparator : path$1, pathSeparator);
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$1 = directoryPath || ".";
97
- if (filters.every((filter) => filter(path$1, true))) paths.push(path$1);
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$1, state, callback$1) {
147
- const { queue, fs: fs$1, options: { suppressErrors } } = state;
140
+ const resolveSymlinksAsync = function(path, state, callback$1) {
141
+ const { queue, fs, options: { suppressErrors } } = state;
148
142
  queue.enqueue();
149
- fs$1.realpath(path$1, (error, resolvedPath) => {
143
+ fs.realpath(path, (error, resolvedPath) => {
150
144
  if (error) return queue.dequeue(suppressErrors ? null : error, state);
151
- fs$1.stat(resolvedPath, (error$1, stat) => {
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$1, resolvedPath, state)) return queue.dequeue(null, state);
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$1, state, callback$1) {
160
- const { queue, fs: fs$1, options: { suppressErrors } } = state;
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$1.realpathSync(path$1);
164
- const stat = fs$1.statSync(resolvedPath);
165
- if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return;
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$1, resolved, state) {
169
+ function isRecursive(path, resolved, state) {
176
170
  if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
177
- let parent = dirname$1(path$1);
178
- let depth$1 = 1;
179
- while (parent !== state.root && depth$1 < 2) {
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$1++;
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$1, resolved);
185
- return depth$1 > 1;
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: fs$1 } = state;
227
+ const { fs } = state;
234
228
  state.visited.push(crawlPath);
235
229
  state.counts.directories++;
236
- fs$1.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
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: fs$1 } = state;
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$1.readdirSync(crawlPath || ".", readdirOpts);
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$1
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$1) => {
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$1 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
366
- if (exclude && exclude(entry.name, path$1)) continue;
367
- this.pushDirectory(path$1, paths, filters);
368
- this.walkDirectory(this.state, path$1, path$1, depth$1 - 1, this.walk);
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$1 = joinPathWithBasePath(entry.name, directoryPath);
371
- this.resolveSymlink(path$1, this.state, (stat, resolvedPath) => {
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$1 + pathSeparator)) return;
375
- this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$1 + pathSeparator, depth$1 - 1, this.walk);
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$1;
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$1) {
461
- this.options.maxDepth = depth$1;
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$1) => isMatch(path$1));
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.3/node_modules/picomatch/lib/constants.js
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: POSIX_REGEX_SOURCE$1,
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.3/node_modules/picomatch/lib/utils.js
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$1, { windows } = {}) => {
754
- const segs = path$1.split(windows ? /[\\/]/ : "/");
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.3/node_modules/picomatch/lib/scan.js
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$3 = require_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$1 = (input, options) => {
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$1 = "";
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$1 = str.slice(lastIndex);
974
+ glob = str.slice(lastIndex);
985
975
  } else if (isGlob === true) {
986
976
  base = "";
987
- glob$1 = str;
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$1) glob$1 = utils$3.removeBackslashes(glob$1);
994
- if (base && backslashes === true) base = utils$3.removeBackslashes(base);
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: glob$1,
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$1;
1036
+ module.exports = scan;
1047
1037
  }));
1048
-
1049
1038
  //#endregion
1050
- //#region ../../node_modules/.bun/picomatch@4.0.3/node_modules/picomatch/lib/parse.js
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$1 = require_constants();
1053
- const utils$2 = require_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$1;
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$2.escapeRegex(v)).join("..");
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$1 = (input, options) => {
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$1.globChars(opts.windows);
1099
- const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
1100
- const { DOT_LITERAL: DOT_LITERAL$1, PLUS_LITERAL: PLUS_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK: QMARK$1, QMARK_NO_DOT, STAR, START_ANCHOR: START_ANCHOR$1 } = PLATFORM_CHARS;
1101
- const globstar = (opts$1) => {
1102
- return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
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$1 : QMARK_NO_DOT;
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$2.removePrefix(input, state);
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$1 = "", num = 0) => {
1141
- state.consumed += value$1;
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$1) => {
1358
+ const extglobOpen = (type, value) => {
1199
1359
  const token = {
1200
- ...EXTGLOB_CHARS[value$1],
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: value$1,
1212
- output: state.output ? "" : ONE_CHAR$1
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$1(rest, {
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$1.repeat(rest.length) : "");
1255
- if (index === 0) return qmarkNoDot + (rest ? QMARK$1.repeat(rest.length) : "");
1256
- return QMARK$1.repeat(chars.length);
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$1.repeat(chars.length);
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$2.wrapOutput(output, state, options);
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$1 = POSIX_REGEX_SOURCE[prev.value.slice(idx + 2)];
1327
- if (posix$1) {
1328
- prev.value = pre + posix$1;
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$1;
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$2.escapeRegex(value);
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$2.hasRegexChars(prevValue)) continue;
1429
- const escaped = utils$2.escapeRegex(prev.value);
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$1
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$1;
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$1
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$1
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$1
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$1
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$1
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$1}|${SLASH_LITERAL$1}${end})`;
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$1}|${globstar(opts)}${SLASH_LITERAL$1})`;
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$1;
1823
- prev.output += ONE_CHAR$1;
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$2.escapeLast(state.output, "[");
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$2.escapeLast(state.output, "(");
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$2.escapeLast(state.output, "{");
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$1}?`
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$1.fastpaths = (input, options) => {
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: DOT_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR: START_ANCHOR$1 } = constants$1.globChars(opts.windows);
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$1) => {
1879
- if (opts$1.noglobstar === true) return star;
1880
- return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
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$1}${star}`;
1885
- case ".*": return `${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
1886
- case "*.*": return `${nodot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
1887
- case "*/*": return `${nodot}${star}${SLASH_LITERAL$1}${ONE_CHAR$1}${slashDot}${star}`;
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$1})?${slashDot}${ONE_CHAR$1}${star}`;
1890
- case "**/*.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
1891
- case "**/.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
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$1 = create(match[1]);
1896
- if (!source$1) return;
1897
- return source$1 + DOT_LITERAL$1 + match[2];
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$2.removePrefix(input, state));
1902
- if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL$1}?`;
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$1;
2091
+ module.exports = parse;
1906
2092
  }));
1907
-
1908
2093
  //#endregion
1909
- //#region ../../node_modules/.bun/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js
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$1 = require_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$2 = (glob$1, options, returnState = false) => {
1938
- if (Array.isArray(glob$1)) {
1939
- const fns = glob$1.map((input) => picomatch$2(input, options, returnState));
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$1 = isMatch(str);
1943
- if (state$1) return state$1;
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$1) && glob$1.tokens && glob$1.input;
1950
- if (glob$1 === "" || typeof glob$1 !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
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$1 = opts.windows;
1953
- const regex = isState ? picomatch$2.compileRe(glob$1, options) : picomatch$2.makeRe(glob$1, options, false, true);
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$2(opts.ignore, ignoreOpts, returnState);
2149
+ isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
1965
2150
  }
1966
2151
  const matcher = (input, returnObject = false) => {
1967
- const { isMatch, match, output } = picomatch$2.test(input, regex, options, {
1968
- glob: glob$1,
1969
- posix: posix$1
2152
+ const { isMatch, match, output } = picomatch.test(input, regex, options, {
2153
+ glob,
2154
+ posix
1970
2155
  });
1971
2156
  const result = {
1972
- glob: glob$1,
2157
+ glob,
1973
2158
  state,
1974
2159
  regex,
1975
- posix: posix$1,
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$2.test = (input, regex, options, { glob: glob$1, posix: posix$1 } = {}) => {
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$1 ? utils$1.toPosixSlashes : null);
2021
- let match = input === glob$1;
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$1;
2210
+ match = output === glob;
2026
2211
  }
2027
- if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch$2.matchBase(input, regex, options, posix$1);
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$2.matchBase = (input, glob$1, options) => {
2049
- return (glob$1 instanceof RegExp ? glob$1 : picomatch$2.makeRe(glob$1, options)).test(utils$1.basename(input));
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$2.isMatch = (str, patterns, options) => picomatch$2(patterns, options)(str);
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$2.parse = (pattern, options) => {
2082
- if (Array.isArray(pattern)) return pattern.map((p) => picomatch$2.parse(p, options));
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$2.scan = (input, options) => scan(input, options);
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$2.compileRe = (state, options, returnOutput = false, returnState = false) => {
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$2.toRegex(source, options);
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
- * const state = picomatch.parse('*.js');
2143
- * // picomatch.compileRe(state[, options]);
2335
+ * // picomatch.makeRe(state[, options]);
2144
2336
  *
2145
- * console.log(picomatch.compileRe(state));
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$2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
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$2.compileRe(parsed, options, returnOutput, returnState);
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$2.toRegex = (source, options) => {
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$2.constants = constants;
2387
+ picomatch.constants = constants;
2195
2388
  /**
2196
2389
  * Expose "picomatch"
2197
2390
  */
2198
- module.exports = picomatch$2;
2391
+ module.exports = picomatch;
2199
2392
  }));
2200
-
2201
2393
  //#endregion
2202
- //#region ../../node_modules/.bun/picomatch@4.0.3/node_modules/picomatch/index.js
2203
- var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
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$1(glob$1, options, returnState = false) {
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$1, options, returnState);
2403
+ return pico(glob, options, returnState);
2212
2404
  }
2213
- Object.assign(picomatch$1, pico);
2214
- module.exports = picomatch$1;
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
- const globstarEnabled = !options.noglobstar;
2228
- for (let i = 0; i < patternsCount; i++) {
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 (let j = 0; j < partsCount; j++) partMatchers[j] = (0, import_picomatch.default)(parts[j], options);
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 (let i = 0; i < patterns.length; i++) {
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
- let j = 0;
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 (globstarEnabled && part === "**") return true;
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 = isRoot(cwd) ? cwd.length : cwd.length + 1;
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
- if (p.endsWith("/") && result !== "") return `${result}/`;
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$1) {
2477
+ function splitPattern(path) {
2290
2478
  var _result$parts;
2291
- const result = import_picomatch.default.scan(path$1, splitPatternOptions);
2292
- return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1];
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$1) => path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
2297
- const escapeWin32Path = (path$1) => path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
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$2 = import_picomatch.default.scan(pattern);
2319
- return scan$2.isGlob || scan$2.negated;
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
- const BACKSLASHES = /\\/g;
2327
- function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
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.endsWith("/")) result = pattern.slice(0, -1);
2330
- if (!result.endsWith("*") && expandDirectories) result += "/**";
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
- if (path.isAbsolute(result.replace(ESCAPING_BACKSLASHES, ""))) result = posix.relative(escapedCwd, result);
2333
- else result = posix.normalize(result);
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 (parentDirectoryMatch === null || parentDirectoryMatch === void 0 ? void 0 : parentDirectoryMatch[0]) {
2337
- const n = (parentDirectoryMatch[0].length + 1) / 3;
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, parentDirectoryMatch[0].slice(i * 3));
2345
- if (!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length) {
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) || i === parts.length - 1) break;
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({ patterns = ["**/*"], ignore = [], expandDirectories = true }, cwd, props) {
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, expandDirectories, cwd, props, true));
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, expandDirectories, cwd, props, false));
2382
- else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), expandDirectories, cwd, props, true));
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 formatPaths(paths, relative$1) {
2390
- for (let i = paths.length - 1; i >= 0; i--) {
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: options.dot,
2589
+ dot,
2428
2590
  nobrace: options.braceExpansion === false,
2429
- nocase: options.caseSensitiveMatch === false,
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, props.root, options.absolute);
2441
- const formatExclude = options.absolute ? format : buildFormat(cwd, props.root, true);
2442
- const fdirOptions = {
2443
- filters: [options.debug ? (p, isDirectory) => {
2444
- const path$1 = format(p, isDirectory);
2445
- const matches = matcher(path$1);
2446
- if (matches) log(`matched ${path$1}`);
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) => matcher(format(p, isDirectory))],
2449
- exclude: options.debug ? (_, p) => {
2450
- const relativePath = formatExclude(p, true);
2451
- const skipped = relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
2452
- if (skipped) log(`skipped ${p}`);
2453
- else log(`crawling ${p}`);
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
- } : (_, p) => {
2456
- const relativePath = formatExclude(p, true);
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: true,
2469
- resolveSymlinks: true,
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
- if (options.deep !== void 0) fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
2473
- if (options.absolute) {
2474
- fdirOptions.relativePaths = false;
2475
- fdirOptions.resolvePaths = true;
2476
- fdirOptions.includeBasePath = true;
2477
- }
2478
- if (options.followSymbolicLinks === false) {
2479
- fdirOptions.resolveSymlinks = false;
2480
- fdirOptions.excludeSymlinks = true;
2481
- }
2482
- if (options.onlyDirectories) {
2483
- fdirOptions.excludeFiles = true;
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
- async function glob(patternsOrOptions, options) {
2493
- if (patternsOrOptions && (options === null || options === void 0 ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
2494
- const isModern = isReadonlyArray(patternsOrOptions) || typeof patternsOrOptions === "string";
2495
- const opts = isModern ? options : patternsOrOptions;
2496
- const [crawler, relative$1] = getCrawler(isModern ? patternsOrOptions : patternsOrOptions.patterns, opts);
2497
- if (!relative$1) return crawler.withPromise();
2498
- return formatPaths(await crawler.withPromise(), relative$1);
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
- //# sourceMappingURL=template-reader-DOXCnctl.mjs.map
2744
+
2745
+ //# sourceMappingURL=template-reader-C8MBRmk-.mjs.map