ccusage 0.2.2 → 0.3.0

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/index.js CHANGED
@@ -1,40 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { createRequire } from "node:module";
2
+ import { __commonJS, __require, __toESM, boolean, getDefaultClaudePath, loadSessionData, loadUsageData, number, object, optional, pipe, record, regex, safeParse, string, union } from "./data-loader-D64xoJ7s.js";
3
+ import { calculateTotals, createTotalsObject, getTotalTokens } from "./calculate-cost-DMC4FhU4.js";
4
+ import { sep } from "node:path";
3
5
  import process$1 from "node:process";
4
- import { readFile } from "node:fs/promises";
5
- import { homedir } from "node:os";
6
- import path, { sep } from "node:path";
7
- import path$1, { posix } from "path";
8
6
  import { formatWithOptions } from "node:util";
9
7
  import * as tty from "node:tty";
10
8
 
11
- //#region rolldown:runtime
12
- var __create = Object.create;
13
- var __defProp = Object.defineProperty;
14
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
15
- var __getOwnPropNames = Object.getOwnPropertyNames;
16
- var __getProtoOf = Object.getPrototypeOf;
17
- var __hasOwnProp = Object.prototype.hasOwnProperty;
18
- var __commonJS = (cb, mod) => function() {
19
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
20
- };
21
- var __copyProps = (to, from, except, desc) => {
22
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i$1 = 0, n$1 = keys.length, key; i$1 < n$1; i$1++) {
23
- key = keys[i$1];
24
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
25
- get: ((k) => from[k]).bind(null, key),
26
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
27
- });
28
- }
29
- return to;
30
- };
31
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
32
- value: mod,
33
- enumerable: true
34
- }) : target, mod));
35
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
36
-
37
- //#endregion
38
9
  //#region node_modules/gunshi/lib/utils-B_QNzw5q.js
39
10
  /**
40
11
  * The default locale string, which format is BCP 47 language tag.
@@ -129,7 +100,7 @@ function mapResourceWithBuiltinKey(resource) {
129
100
  function create(obj = null) {
130
101
  return Object.create(obj);
131
102
  }
132
- function log$2(...args) {
103
+ function log$1(...args) {
133
104
  console.log(...args);
134
105
  }
135
106
  function deepFreeze(obj) {
@@ -274,7 +245,7 @@ async function createCommandContext({ args, values, positionals, rest, argv: arg
274
245
  _: argv$2,
275
246
  tokens,
276
247
  toKebab: command.toKebab,
277
- log: cliOptions.usageSilent ? NOOP : log$2,
248
+ log: cliOptions.usageSilent ? NOOP : log$1,
278
249
  loadCommands,
279
250
  translate
280
251
  }));
@@ -950,7 +921,7 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
950
921
  continue;
951
922
  }
952
923
  if (schema.type === "boolean") token.value = void 0;
953
- const [parsedValue, error] = parse$2(token, arg, schema);
924
+ const [parsedValue, error] = parse(token, arg, schema);
954
925
  if (error) errors.push(error);
955
926
  else if (schema.multiple) {
956
927
  values[rawArg] ||= [];
@@ -967,7 +938,7 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
967
938
  error: errors.length > 0 ? new AggregateError(errors) : void 0
968
939
  };
969
940
  }
970
- function parse$2(token, option, schema) {
941
+ function parse(token, option, schema) {
971
942
  switch (schema.type) {
972
943
  case "string": return typeof token.value === "string" ? [token.value || schema.default, void 0] : [void 0, createTypeError(option, schema)];
973
944
  case "boolean": return token.value ? [token.value || schema.default, void 0] : [!(schema.negatable && token.name.startsWith("no-")), void 0];
@@ -1247,7 +1218,7 @@ var require_string_width = __commonJS({ "node_modules/string-width/index.js"(exp
1247
1218
 
1248
1219
  //#endregion
1249
1220
  //#region node_modules/cli-table3/src/utils.js
1250
- var require_utils$2 = __commonJS({ "node_modules/cli-table3/src/utils.js"(exports, module) {
1221
+ var require_utils = __commonJS({ "node_modules/cli-table3/src/utils.js"(exports, module) {
1251
1222
  const stringWidth$2 = require_string_width();
1252
1223
  function codeRegex(capture) {
1253
1224
  return capture ? /\u001b\[((?:\d*;){0,5}\d*)m/g : /\u001b\[(?:\d*;){0,5}\d*m/g;
@@ -1505,19 +1476,19 @@ var require_utils$2 = __commonJS({ "node_modules/cli-table3/src/utils.js"(export
1505
1476
  function hyperlink(url, text) {
1506
1477
  const OSC = "\x1B]";
1507
1478
  const BEL = "\x07";
1508
- const SEP$1 = ";";
1479
+ const SEP = ";";
1509
1480
  return [
1510
1481
  OSC,
1511
1482
  "8",
1512
- SEP$1,
1513
- SEP$1,
1483
+ SEP,
1484
+ SEP,
1514
1485
  url || text,
1515
1486
  BEL,
1516
1487
  text,
1517
1488
  OSC,
1518
1489
  "8",
1519
- SEP$1,
1520
- SEP$1,
1490
+ SEP,
1491
+ SEP,
1521
1492
  BEL
1522
1493
  ].join("");
1523
1494
  }
@@ -2116,7 +2087,7 @@ var require_colors = __commonJS({ "node_modules/@colors/colors/lib/colors.js"(ex
2116
2087
  if (typeof str !== "string") throw new TypeError("Expected a string");
2117
2088
  return str.replace(matchOperatorsRe, "\\$&");
2118
2089
  };
2119
- function build$8(_styles) {
2090
+ function build(_styles) {
2120
2091
  var builder = function builder$1() {
2121
2092
  return applyStyle.apply(builder$1, arguments);
2122
2093
  };
@@ -2130,7 +2101,7 @@ var require_colors = __commonJS({ "node_modules/@colors/colors/lib/colors.js"(ex
2130
2101
  Object.keys(ansiStyles).forEach(function(key) {
2131
2102
  ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), "g");
2132
2103
  ret[key] = { get: function() {
2133
- return build$8(this._styles.concat(key));
2104
+ return build(this._styles.concat(key));
2134
2105
  } };
2135
2106
  });
2136
2107
  return ret;
@@ -2175,7 +2146,7 @@ var require_colors = __commonJS({ "node_modules/@colors/colors/lib/colors.js"(ex
2175
2146
  var ret = {};
2176
2147
  Object.keys(styles).forEach(function(name$1) {
2177
2148
  ret[name$1] = { get: function() {
2178
- return build$8([name$1]);
2149
+ return build([name$1]);
2179
2150
  } };
2180
2151
  });
2181
2152
  return ret;
@@ -2211,7 +2182,7 @@ var require_safe = __commonJS({ "node_modules/@colors/colors/safe.js"(exports, m
2211
2182
  //#region node_modules/cli-table3/src/cell.js
2212
2183
  var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, module) {
2213
2184
  const { info, debug: debug$2 } = require_debug();
2214
- const utils$5 = require_utils$2();
2185
+ const utils$1 = require_utils();
2215
2186
  var Cell$1 = class Cell$1 {
2216
2187
  /**
2217
2188
  * A representation of a cell within the table.
@@ -2271,7 +2242,7 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
2271
2242
  this.border = style.border || tableStyle.border;
2272
2243
  this.fixedWidth = tableOptions.colWidths[this.x];
2273
2244
  this.lines = this.computeLines(tableOptions);
2274
- this.desiredWidth = utils$5.strlen(this.content) + this.paddingLeft + this.paddingRight;
2245
+ this.desiredWidth = utils$1.strlen(this.content) + this.paddingLeft + this.paddingRight;
2275
2246
  this.desiredHeight = this.lines.length;
2276
2247
  }
2277
2248
  computeLines(tableOptions) {
@@ -2288,13 +2259,13 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
2288
2259
  }
2289
2260
  const { wrapOnWordBoundary: tableWrapOnWordBoundary = true } = tableOptions;
2290
2261
  const { wrapOnWordBoundary = tableWrapOnWordBoundary } = this.options;
2291
- return this.wrapLines(utils$5.wordWrap(this.fixedWidth, this.content, wrapOnWordBoundary));
2262
+ return this.wrapLines(utils$1.wordWrap(this.fixedWidth, this.content, wrapOnWordBoundary));
2292
2263
  }
2293
2264
  return this.wrapLines(this.content.split("\n"));
2294
2265
  }
2295
2266
  wrapLines(computedLines) {
2296
- const lines = utils$5.colorizeLines(computedLines);
2297
- if (this.href) return lines.map((line) => utils$5.hyperlink(this.href, line));
2267
+ const lines = utils$1.colorizeLines(computedLines);
2268
+ if (this.href) return lines.map((line) => utils$1.hyperlink(this.href, line));
2298
2269
  return lines;
2299
2270
  }
2300
2271
  /**
@@ -2328,7 +2299,7 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
2328
2299
  draw(lineNum, spanningCell) {
2329
2300
  if (lineNum == "top") return this.drawTop(this.drawRight);
2330
2301
  if (lineNum == "bottom") return this.drawBottom(this.drawRight);
2331
- let content = utils$5.truncate(this.content, 10, this.truncate);
2302
+ let content = utils$1.truncate(this.content, 10, this.truncate);
2332
2303
  if (!lineNum) info(`${this.y}-${this.x}: ${this.rowSpan - lineNum}x${this.colSpan} Cell ${content}`);
2333
2304
  let padLen = Math.max(this.height - this.lines.length, 0);
2334
2305
  let padTop;
@@ -2354,11 +2325,11 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
2354
2325
  let content = [];
2355
2326
  if (this.cells) this.widths.forEach(function(width, index) {
2356
2327
  content.push(this._topLeftChar(index));
2357
- content.push(utils$5.repeat(this.chars[this.y == 0 ? "top" : "mid"], width));
2328
+ content.push(utils$1.repeat(this.chars[this.y == 0 ? "top" : "mid"], width));
2358
2329
  }, this);
2359
2330
  else {
2360
2331
  content.push(this._topLeftChar(0));
2361
- content.push(utils$5.repeat(this.chars[this.y == 0 ? "top" : "mid"], this.width));
2332
+ content.push(utils$1.repeat(this.chars[this.y == 0 ? "top" : "mid"], this.width));
2362
2333
  }
2363
2334
  if (drawRight) content.push(this.chars[this.y == 0 ? "topRight" : "rightMid"]);
2364
2335
  return this.wrapWithStyleColors("border", content.join(""));
@@ -2410,14 +2381,14 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
2410
2381
  while (cellLeft instanceof ColSpanCell$1) cellLeft = this.cells[cellLeft.y][cellLeft.x - 1];
2411
2382
  if (!(cellLeft instanceof RowSpanCell$1)) left = this.chars["rightMid"];
2412
2383
  }
2413
- let leftPadding = utils$5.repeat(" ", this.paddingLeft);
2384
+ let leftPadding = utils$1.repeat(" ", this.paddingLeft);
2414
2385
  let right = drawRight ? this.chars["right"] : "";
2415
- let rightPadding = utils$5.repeat(" ", this.paddingRight);
2386
+ let rightPadding = utils$1.repeat(" ", this.paddingRight);
2416
2387
  let line = this.lines[lineNum];
2417
2388
  let len = this.width - (this.paddingLeft + this.paddingRight);
2418
2389
  if (forceTruncationSymbol) line += this.truncate || "…";
2419
- let content = utils$5.truncate(line, len, this.truncate);
2420
- content = utils$5.pad(content, len, " ", this.hAlign);
2390
+ let content = utils$1.truncate(line, len, this.truncate);
2391
+ content = utils$1.pad(content, len, " ", this.hAlign);
2421
2392
  content = leftPadding + content + rightPadding;
2422
2393
  return this.stylizeLine(left, content, right);
2423
2394
  }
@@ -2434,7 +2405,7 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
2434
2405
  */
2435
2406
  drawBottom(drawRight) {
2436
2407
  let left = this.chars[this.x == 0 ? "bottomLeft" : "bottomMid"];
2437
- let content = utils$5.repeat(this.chars.bottom, this.width);
2408
+ let content = utils$1.repeat(this.chars.bottom, this.width);
2438
2409
  let right = drawRight ? this.chars["bottomRight"] : "";
2439
2410
  return this.wrapWithStyleColors("border", left + content + right);
2440
2411
  }
@@ -2452,7 +2423,7 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
2452
2423
  if (!(cellLeft instanceof RowSpanCell$1)) left = this.chars["rightMid"];
2453
2424
  }
2454
2425
  let right = drawRight ? this.chars["right"] : "";
2455
- let content = utils$5.repeat(" ", this.width);
2426
+ let content = utils$1.repeat(" ", this.width);
2456
2427
  return this.stylizeLine(left, content, right);
2457
2428
  }
2458
2429
  };
@@ -2749,12 +2720,12 @@ var require_layout_manager = __commonJS({ "node_modules/cli-table3/src/layout-ma
2749
2720
  //#region node_modules/cli-table3/src/table.js
2750
2721
  var require_table = __commonJS({ "node_modules/cli-table3/src/table.js"(exports, module) {
2751
2722
  const debug = require_debug();
2752
- const utils$4 = require_utils$2();
2723
+ const utils = require_utils();
2753
2724
  const tableLayout = require_layout_manager();
2754
2725
  var Table$2 = class extends Array {
2755
2726
  constructor(opts) {
2756
2727
  super();
2757
- const options = utils$4.mergeOptions(opts);
2728
+ const options = utils.mergeOptions(opts);
2758
2729
  Object.defineProperty(this, "options", {
2759
2730
  value: options,
2760
2731
  enumerable: options.debug
@@ -2901,3210 +2872,6 @@ var require_picocolors = __commonJS({ "node_modules/picocolors/picocolors.js"(ex
2901
2872
  module.exports.createColors = createColors$1;
2902
2873
  } });
2903
2874
 
2904
- //#endregion
2905
- //#region calculate-cost.ts
2906
- function calculateTotals(data) {
2907
- return data.reduce((acc, item) => ({
2908
- inputTokens: acc.inputTokens + item.inputTokens,
2909
- outputTokens: acc.outputTokens + item.outputTokens,
2910
- cacheCreationTokens: acc.cacheCreationTokens + item.cacheCreationTokens,
2911
- cacheReadTokens: acc.cacheReadTokens + item.cacheReadTokens,
2912
- totalCost: acc.totalCost + item.totalCost
2913
- }), {
2914
- inputTokens: 0,
2915
- outputTokens: 0,
2916
- cacheCreationTokens: 0,
2917
- cacheReadTokens: 0,
2918
- totalCost: 0
2919
- });
2920
- }
2921
- function getTotalTokens(tokens) {
2922
- return tokens.inputTokens + tokens.outputTokens + tokens.cacheCreationTokens + tokens.cacheReadTokens;
2923
- }
2924
- function createTotalsObject(totals) {
2925
- return {
2926
- inputTokens: totals.inputTokens,
2927
- outputTokens: totals.outputTokens,
2928
- cacheCreationTokens: totals.cacheCreationTokens,
2929
- cacheReadTokens: totals.cacheReadTokens,
2930
- totalTokens: getTotalTokens(totals),
2931
- totalCost: totals.totalCost
2932
- };
2933
- }
2934
-
2935
- //#endregion
2936
- //#region node_modules/fdir/dist/utils.js
2937
- var require_utils$1 = __commonJS({ "node_modules/fdir/dist/utils.js"(exports) {
2938
- Object.defineProperty(exports, "__esModule", { value: true });
2939
- exports.cleanPath = cleanPath;
2940
- exports.convertSlashes = convertSlashes;
2941
- exports.isRootDirectory = isRootDirectory;
2942
- exports.normalizePath = normalizePath;
2943
- const path_1$4 = __require("path");
2944
- function cleanPath(path$2) {
2945
- let normalized = (0, path_1$4.normalize)(path$2);
2946
- if (normalized.length > 1 && normalized[normalized.length - 1] === path_1$4.sep) normalized = normalized.substring(0, normalized.length - 1);
2947
- return normalized;
2948
- }
2949
- const SLASHES_REGEX = /[\\/]/g;
2950
- function convertSlashes(path$2, separator) {
2951
- return path$2.replace(SLASHES_REGEX, separator);
2952
- }
2953
- const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
2954
- function isRootDirectory(path$2) {
2955
- return path$2 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path$2);
2956
- }
2957
- function normalizePath(path$2, options) {
2958
- const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
2959
- const pathNeedsCleaning = process.platform === "win32" && path$2.includes("/") || path$2.startsWith(".");
2960
- if (resolvePaths) path$2 = (0, path_1$4.resolve)(path$2);
2961
- if (normalizePath$1 || pathNeedsCleaning) path$2 = cleanPath(path$2);
2962
- if (path$2 === ".") return "";
2963
- const needsSeperator = path$2[path$2.length - 1] !== pathSeparator;
2964
- return convertSlashes(needsSeperator ? path$2 + pathSeparator : path$2, pathSeparator);
2965
- }
2966
- } });
2967
-
2968
- //#endregion
2969
- //#region node_modules/fdir/dist/api/functions/join-path.js
2970
- var require_join_path = __commonJS({ "node_modules/fdir/dist/api/functions/join-path.js"(exports) {
2971
- Object.defineProperty(exports, "__esModule", { value: true });
2972
- exports.joinPathWithBasePath = joinPathWithBasePath;
2973
- exports.joinDirectoryPath = joinDirectoryPath;
2974
- exports.build = build$7;
2975
- const path_1$3 = __require("path");
2976
- const utils_1$1 = require_utils$1();
2977
- function joinPathWithBasePath(filename, directoryPath) {
2978
- return directoryPath + filename;
2979
- }
2980
- function joinPathWithRelativePath(root, options) {
2981
- return function(filename, directoryPath) {
2982
- const sameRoot = directoryPath.startsWith(root);
2983
- if (sameRoot) return directoryPath.replace(root, "") + filename;
2984
- else return (0, utils_1$1.convertSlashes)((0, path_1$3.relative)(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
2985
- };
2986
- }
2987
- function joinPath$1(filename) {
2988
- return filename;
2989
- }
2990
- function joinDirectoryPath(filename, directoryPath, separator) {
2991
- return directoryPath + filename + separator;
2992
- }
2993
- function build$7(root, options) {
2994
- const { relativePaths, includeBasePath } = options;
2995
- return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath$1;
2996
- }
2997
- } });
2998
-
2999
- //#endregion
3000
- //#region node_modules/fdir/dist/api/functions/push-directory.js
3001
- var require_push_directory = __commonJS({ "node_modules/fdir/dist/api/functions/push-directory.js"(exports) {
3002
- Object.defineProperty(exports, "__esModule", { value: true });
3003
- exports.build = build$6;
3004
- function pushDirectoryWithRelativePath(root) {
3005
- return function(directoryPath, paths) {
3006
- paths.push(directoryPath.substring(root.length) || ".");
3007
- };
3008
- }
3009
- function pushDirectoryFilterWithRelativePath(root) {
3010
- return function(directoryPath, paths, filters) {
3011
- const relativePath = directoryPath.substring(root.length) || ".";
3012
- if (filters.every((filter) => filter(relativePath, true))) paths.push(relativePath);
3013
- };
3014
- }
3015
- const pushDirectory$1 = (directoryPath, paths) => {
3016
- paths.push(directoryPath || ".");
3017
- };
3018
- const pushDirectoryFilter = (directoryPath, paths, filters) => {
3019
- const path$2 = directoryPath || ".";
3020
- if (filters.every((filter) => filter(path$2, true))) paths.push(path$2);
3021
- };
3022
- const empty$2 = () => {};
3023
- function build$6(root, options) {
3024
- const { includeDirs, filters, relativePaths } = options;
3025
- if (!includeDirs) return empty$2;
3026
- if (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root);
3027
- return filters && filters.length ? pushDirectoryFilter : pushDirectory$1;
3028
- }
3029
- } });
3030
-
3031
- //#endregion
3032
- //#region node_modules/fdir/dist/api/functions/push-file.js
3033
- var require_push_file = __commonJS({ "node_modules/fdir/dist/api/functions/push-file.js"(exports) {
3034
- Object.defineProperty(exports, "__esModule", { value: true });
3035
- exports.build = build$5;
3036
- const pushFileFilterAndCount = (filename, _paths, counts, filters) => {
3037
- if (filters.every((filter) => filter(filename, false))) counts.files++;
3038
- };
3039
- const pushFileFilter = (filename, paths, _counts, filters) => {
3040
- if (filters.every((filter) => filter(filename, false))) paths.push(filename);
3041
- };
3042
- const pushFileCount = (_filename, _paths, counts, _filters) => {
3043
- counts.files++;
3044
- };
3045
- const pushFile$1 = (filename, paths) => {
3046
- paths.push(filename);
3047
- };
3048
- const empty$1 = () => {};
3049
- function build$5(options) {
3050
- const { excludeFiles, filters, onlyCounts } = options;
3051
- if (excludeFiles) return empty$1;
3052
- if (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
3053
- else if (onlyCounts) return pushFileCount;
3054
- else return pushFile$1;
3055
- }
3056
- } });
3057
-
3058
- //#endregion
3059
- //#region node_modules/fdir/dist/api/functions/get-array.js
3060
- var require_get_array = __commonJS({ "node_modules/fdir/dist/api/functions/get-array.js"(exports) {
3061
- Object.defineProperty(exports, "__esModule", { value: true });
3062
- exports.build = build$4;
3063
- const getArray$1 = (paths) => {
3064
- return paths;
3065
- };
3066
- const getArrayGroup = () => {
3067
- return [""].slice(0, 0);
3068
- };
3069
- function build$4(options) {
3070
- return options.group ? getArrayGroup : getArray$1;
3071
- }
3072
- } });
3073
-
3074
- //#endregion
3075
- //#region node_modules/fdir/dist/api/functions/group-files.js
3076
- var require_group_files = __commonJS({ "node_modules/fdir/dist/api/functions/group-files.js"(exports) {
3077
- Object.defineProperty(exports, "__esModule", { value: true });
3078
- exports.build = build$3;
3079
- const groupFiles$1 = (groups, directory, files) => {
3080
- groups.push({
3081
- directory,
3082
- files,
3083
- dir: directory
3084
- });
3085
- };
3086
- const empty = () => {};
3087
- function build$3(options) {
3088
- return options.group ? groupFiles$1 : empty;
3089
- }
3090
- } });
3091
-
3092
- //#endregion
3093
- //#region node_modules/fdir/dist/api/functions/resolve-symlink.js
3094
- var require_resolve_symlink = __commonJS({ "node_modules/fdir/dist/api/functions/resolve-symlink.js"(exports) {
3095
- var __importDefault$1 = void 0 && (void 0).__importDefault || function(mod) {
3096
- return mod && mod.__esModule ? mod : { "default": mod };
3097
- };
3098
- Object.defineProperty(exports, "__esModule", { value: true });
3099
- exports.build = build$2;
3100
- const fs_1$1 = __importDefault$1(__require("fs"));
3101
- const path_1$2 = __require("path");
3102
- const resolveSymlinksAsync = function(path$2, state, callback$1) {
3103
- const { queue: queue$1, options: { suppressErrors } } = state;
3104
- queue$1.enqueue();
3105
- fs_1$1.default.realpath(path$2, (error, resolvedPath) => {
3106
- if (error) return queue$1.dequeue(suppressErrors ? null : error, state);
3107
- fs_1$1.default.stat(resolvedPath, (error$1, stat) => {
3108
- if (error$1) return queue$1.dequeue(suppressErrors ? null : error$1, state);
3109
- if (stat.isDirectory() && isRecursive(path$2, resolvedPath, state)) return queue$1.dequeue(null, state);
3110
- callback$1(stat, resolvedPath);
3111
- queue$1.dequeue(null, state);
3112
- });
3113
- });
3114
- };
3115
- const resolveSymlinks = function(path$2, state, callback$1) {
3116
- const { queue: queue$1, options: { suppressErrors } } = state;
3117
- queue$1.enqueue();
3118
- try {
3119
- const resolvedPath = fs_1$1.default.realpathSync(path$2);
3120
- const stat = fs_1$1.default.statSync(resolvedPath);
3121
- if (stat.isDirectory() && isRecursive(path$2, resolvedPath, state)) return;
3122
- callback$1(stat, resolvedPath);
3123
- } catch (e) {
3124
- if (!suppressErrors) throw e;
3125
- }
3126
- };
3127
- function build$2(options, isSynchronous) {
3128
- if (!options.resolveSymlinks || options.excludeSymlinks) return null;
3129
- return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
3130
- }
3131
- function isRecursive(path$2, resolved, state) {
3132
- if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
3133
- let parent = (0, path_1$2.dirname)(path$2);
3134
- let depth$1 = 1;
3135
- while (parent !== state.root && depth$1 < 2) {
3136
- const resolvedPath = state.symlinks.get(parent);
3137
- const isSameRoot = !!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath));
3138
- if (isSameRoot) depth$1++;
3139
- else parent = (0, path_1$2.dirname)(parent);
3140
- }
3141
- state.symlinks.set(path$2, resolved);
3142
- return depth$1 > 1;
3143
- }
3144
- function isRecursiveUsingRealPaths(resolved, state) {
3145
- return state.visited.includes(resolved + state.options.pathSeparator);
3146
- }
3147
- } });
3148
-
3149
- //#endregion
3150
- //#region node_modules/fdir/dist/api/functions/invoke-callback.js
3151
- var require_invoke_callback = __commonJS({ "node_modules/fdir/dist/api/functions/invoke-callback.js"(exports) {
3152
- Object.defineProperty(exports, "__esModule", { value: true });
3153
- exports.build = build$1;
3154
- const onlyCountsSync = (state) => {
3155
- return state.counts;
3156
- };
3157
- const groupsSync = (state) => {
3158
- return state.groups;
3159
- };
3160
- const defaultSync = (state) => {
3161
- return state.paths;
3162
- };
3163
- const limitFilesSync = (state) => {
3164
- return state.paths.slice(0, state.options.maxFiles);
3165
- };
3166
- const onlyCountsAsync = (state, error, callback$1) => {
3167
- report(error, callback$1, state.counts, state.options.suppressErrors);
3168
- return null;
3169
- };
3170
- const defaultAsync = (state, error, callback$1) => {
3171
- report(error, callback$1, state.paths, state.options.suppressErrors);
3172
- return null;
3173
- };
3174
- const limitFilesAsync = (state, error, callback$1) => {
3175
- report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
3176
- return null;
3177
- };
3178
- const groupsAsync = (state, error, callback$1) => {
3179
- report(error, callback$1, state.groups, state.options.suppressErrors);
3180
- return null;
3181
- };
3182
- function report(error, callback$1, output, suppressErrors) {
3183
- if (error && !suppressErrors) callback$1(error, output);
3184
- else callback$1(null, output);
3185
- }
3186
- function build$1(options, isSynchronous) {
3187
- const { onlyCounts, group, maxFiles } = options;
3188
- if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync;
3189
- else if (group) return isSynchronous ? groupsSync : groupsAsync;
3190
- else if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync;
3191
- else return isSynchronous ? defaultSync : defaultAsync;
3192
- }
3193
- } });
3194
-
3195
- //#endregion
3196
- //#region node_modules/fdir/dist/api/functions/walk-directory.js
3197
- var require_walk_directory = __commonJS({ "node_modules/fdir/dist/api/functions/walk-directory.js"(exports) {
3198
- var __importDefault = void 0 && (void 0).__importDefault || function(mod) {
3199
- return mod && mod.__esModule ? mod : { "default": mod };
3200
- };
3201
- Object.defineProperty(exports, "__esModule", { value: true });
3202
- exports.build = build;
3203
- const fs_1 = __importDefault(__require("fs"));
3204
- const readdirOpts = { withFileTypes: true };
3205
- const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
3206
- state.queue.enqueue();
3207
- if (currentDepth <= 0) return state.queue.dequeue(null, state);
3208
- state.visited.push(crawlPath);
3209
- state.counts.directories++;
3210
- fs_1.default.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
3211
- callback$1(entries, directoryPath, currentDepth);
3212
- state.queue.dequeue(state.options.suppressErrors ? null : error, state);
3213
- });
3214
- };
3215
- const walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
3216
- if (currentDepth <= 0) return;
3217
- state.visited.push(crawlPath);
3218
- state.counts.directories++;
3219
- let entries = [];
3220
- try {
3221
- entries = fs_1.default.readdirSync(crawlPath || ".", readdirOpts);
3222
- } catch (e) {
3223
- if (!state.options.suppressErrors) throw e;
3224
- }
3225
- callback$1(entries, directoryPath, currentDepth);
3226
- };
3227
- function build(isSynchronous) {
3228
- return isSynchronous ? walkSync : walkAsync;
3229
- }
3230
- } });
3231
-
3232
- //#endregion
3233
- //#region node_modules/fdir/dist/api/queue.js
3234
- var require_queue = __commonJS({ "node_modules/fdir/dist/api/queue.js"(exports) {
3235
- Object.defineProperty(exports, "__esModule", { value: true });
3236
- exports.Queue = void 0;
3237
- /**
3238
- * This is a custom stateless queue to track concurrent async fs calls.
3239
- * It increments a counter whenever a call is queued and decrements it
3240
- * as soon as it completes. When the counter hits 0, it calls onQueueEmpty.
3241
- */
3242
- var Queue = class {
3243
- onQueueEmpty;
3244
- count = 0;
3245
- constructor(onQueueEmpty) {
3246
- this.onQueueEmpty = onQueueEmpty;
3247
- }
3248
- enqueue() {
3249
- this.count++;
3250
- return this.count;
3251
- }
3252
- dequeue(error, output) {
3253
- if (this.onQueueEmpty && (--this.count <= 0 || error)) {
3254
- this.onQueueEmpty(error, output);
3255
- if (error) {
3256
- output.controller.abort();
3257
- this.onQueueEmpty = void 0;
3258
- }
3259
- }
3260
- }
3261
- };
3262
- exports.Queue = Queue;
3263
- } });
3264
-
3265
- //#endregion
3266
- //#region node_modules/fdir/dist/api/counter.js
3267
- var require_counter = __commonJS({ "node_modules/fdir/dist/api/counter.js"(exports) {
3268
- Object.defineProperty(exports, "__esModule", { value: true });
3269
- exports.Counter = void 0;
3270
- var Counter = class {
3271
- _files = 0;
3272
- _directories = 0;
3273
- set files(num) {
3274
- this._files = num;
3275
- }
3276
- get files() {
3277
- return this._files;
3278
- }
3279
- set directories(num) {
3280
- this._directories = num;
3281
- }
3282
- get directories() {
3283
- return this._directories;
3284
- }
3285
- /**
3286
- * @deprecated use `directories` instead
3287
- */
3288
- /* c8 ignore next 3 */
3289
- get dirs() {
3290
- return this._directories;
3291
- }
3292
- };
3293
- exports.Counter = Counter;
3294
- } });
3295
-
3296
- //#endregion
3297
- //#region node_modules/fdir/dist/api/walker.js
3298
- var require_walker = __commonJS({ "node_modules/fdir/dist/api/walker.js"(exports) {
3299
- var __createBinding$1 = void 0 && (void 0).__createBinding || (Object.create ? function(o$1, m, k, k2) {
3300
- if (k2 === void 0) k2 = k;
3301
- var desc = Object.getOwnPropertyDescriptor(m, k);
3302
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
3303
- enumerable: true,
3304
- get: function() {
3305
- return m[k];
3306
- }
3307
- };
3308
- Object.defineProperty(o$1, k2, desc);
3309
- } : function(o$1, m, k, k2) {
3310
- if (k2 === void 0) k2 = k;
3311
- o$1[k2] = m[k];
3312
- });
3313
- var __setModuleDefault = void 0 && (void 0).__setModuleDefault || (Object.create ? function(o$1, v) {
3314
- Object.defineProperty(o$1, "default", {
3315
- enumerable: true,
3316
- value: v
3317
- });
3318
- } : function(o$1, v) {
3319
- o$1["default"] = v;
3320
- });
3321
- var __importStar = void 0 && (void 0).__importStar || function() {
3322
- var ownKeys = function(o$1) {
3323
- ownKeys = Object.getOwnPropertyNames || function(o$2) {
3324
- var ar = [];
3325
- for (var k in o$2) if (Object.prototype.hasOwnProperty.call(o$2, k)) ar[ar.length] = k;
3326
- return ar;
3327
- };
3328
- return ownKeys(o$1);
3329
- };
3330
- return function(mod) {
3331
- if (mod && mod.__esModule) return mod;
3332
- var result = {};
3333
- if (mod != null) {
3334
- for (var k = ownKeys(mod), i$1 = 0; i$1 < k.length; i$1++) if (k[i$1] !== "default") __createBinding$1(result, mod, k[i$1]);
3335
- }
3336
- __setModuleDefault(result, mod);
3337
- return result;
3338
- };
3339
- }();
3340
- Object.defineProperty(exports, "__esModule", { value: true });
3341
- exports.Walker = void 0;
3342
- const path_1$1 = __require("path");
3343
- const utils_1 = require_utils$1();
3344
- const joinPath = __importStar(require_join_path());
3345
- const pushDirectory = __importStar(require_push_directory());
3346
- const pushFile = __importStar(require_push_file());
3347
- const getArray = __importStar(require_get_array());
3348
- const groupFiles = __importStar(require_group_files());
3349
- const resolveSymlink = __importStar(require_resolve_symlink());
3350
- const invokeCallback = __importStar(require_invoke_callback());
3351
- const walkDirectory = __importStar(require_walk_directory());
3352
- const queue_1 = require_queue();
3353
- const counter_1 = require_counter();
3354
- var Walker = class {
3355
- root;
3356
- isSynchronous;
3357
- state;
3358
- joinPath;
3359
- pushDirectory;
3360
- pushFile;
3361
- getArray;
3362
- groupFiles;
3363
- resolveSymlink;
3364
- walkDirectory;
3365
- callbackInvoker;
3366
- constructor(root, options, callback$1) {
3367
- this.isSynchronous = !callback$1;
3368
- this.callbackInvoker = invokeCallback.build(options, this.isSynchronous);
3369
- this.root = (0, utils_1.normalizePath)(root, options);
3370
- this.state = {
3371
- root: (0, utils_1.isRootDirectory)(this.root) ? this.root : this.root.slice(0, -1),
3372
- paths: [""].slice(0, 0),
3373
- groups: [],
3374
- counts: new counter_1.Counter(),
3375
- options,
3376
- queue: new queue_1.Queue((error, state) => this.callbackInvoker(state, error, callback$1)),
3377
- symlinks: new Map(),
3378
- visited: [""].slice(0, 0),
3379
- controller: new AbortController()
3380
- };
3381
- this.joinPath = joinPath.build(this.root, options);
3382
- this.pushDirectory = pushDirectory.build(this.root, options);
3383
- this.pushFile = pushFile.build(options);
3384
- this.getArray = getArray.build(options);
3385
- this.groupFiles = groupFiles.build(options);
3386
- this.resolveSymlink = resolveSymlink.build(options, this.isSynchronous);
3387
- this.walkDirectory = walkDirectory.build(this.isSynchronous);
3388
- }
3389
- start() {
3390
- this.pushDirectory(this.root, this.state.paths, this.state.options.filters);
3391
- this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
3392
- return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
3393
- }
3394
- walk = (entries, directoryPath, depth$1) => {
3395
- const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state;
3396
- if (controller.signal.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles) return;
3397
- const files = this.getArray(this.state.paths);
3398
- for (let i$1 = 0; i$1 < entries.length; ++i$1) {
3399
- const entry = entries[i$1];
3400
- if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) {
3401
- const filename = this.joinPath(entry.name, directoryPath);
3402
- this.pushFile(filename, files, this.state.counts, filters);
3403
- } else if (entry.isDirectory()) {
3404
- let path$2 = joinPath.joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
3405
- if (exclude && exclude(entry.name, path$2)) continue;
3406
- this.pushDirectory(path$2, paths, filters);
3407
- this.walkDirectory(this.state, path$2, path$2, depth$1 - 1, this.walk);
3408
- } else if (this.resolveSymlink && entry.isSymbolicLink()) {
3409
- let path$2 = joinPath.joinPathWithBasePath(entry.name, directoryPath);
3410
- this.resolveSymlink(path$2, this.state, (stat, resolvedPath) => {
3411
- if (stat.isDirectory()) {
3412
- resolvedPath = (0, utils_1.normalizePath)(resolvedPath, this.state.options);
3413
- if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$2 + pathSeparator)) return;
3414
- this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$2 + pathSeparator, depth$1 - 1, this.walk);
3415
- } else {
3416
- resolvedPath = useRealPaths ? resolvedPath : path$2;
3417
- const filename = (0, path_1$1.basename)(resolvedPath);
3418
- const directoryPath$1 = (0, utils_1.normalizePath)((0, path_1$1.dirname)(resolvedPath), this.state.options);
3419
- resolvedPath = this.joinPath(filename, directoryPath$1);
3420
- this.pushFile(resolvedPath, files, this.state.counts, filters);
3421
- }
3422
- });
3423
- }
3424
- }
3425
- this.groupFiles(this.state.groups, directoryPath, files);
3426
- };
3427
- };
3428
- exports.Walker = Walker;
3429
- } });
3430
-
3431
- //#endregion
3432
- //#region node_modules/fdir/dist/api/async.js
3433
- var require_async = __commonJS({ "node_modules/fdir/dist/api/async.js"(exports) {
3434
- Object.defineProperty(exports, "__esModule", { value: true });
3435
- exports.promise = promise;
3436
- exports.callback = callback;
3437
- const walker_1$1 = require_walker();
3438
- function promise(root, options) {
3439
- return new Promise((resolve, reject) => {
3440
- callback(root, options, (err, output) => {
3441
- if (err) return reject(err);
3442
- resolve(output);
3443
- });
3444
- });
3445
- }
3446
- function callback(root, options, callback$1) {
3447
- let walker = new walker_1$1.Walker(root, options, callback$1);
3448
- walker.start();
3449
- }
3450
- } });
3451
-
3452
- //#endregion
3453
- //#region node_modules/fdir/dist/api/sync.js
3454
- var require_sync = __commonJS({ "node_modules/fdir/dist/api/sync.js"(exports) {
3455
- Object.defineProperty(exports, "__esModule", { value: true });
3456
- exports.sync = sync;
3457
- const walker_1 = require_walker();
3458
- function sync(root, options) {
3459
- const walker = new walker_1.Walker(root, options);
3460
- return walker.start();
3461
- }
3462
- } });
3463
-
3464
- //#endregion
3465
- //#region node_modules/fdir/dist/builder/api-builder.js
3466
- var require_api_builder = __commonJS({ "node_modules/fdir/dist/builder/api-builder.js"(exports) {
3467
- Object.defineProperty(exports, "__esModule", { value: true });
3468
- exports.APIBuilder = void 0;
3469
- const async_1 = require_async();
3470
- const sync_1 = require_sync();
3471
- var APIBuilder = class {
3472
- root;
3473
- options;
3474
- constructor(root, options) {
3475
- this.root = root;
3476
- this.options = options;
3477
- }
3478
- withPromise() {
3479
- return (0, async_1.promise)(this.root, this.options);
3480
- }
3481
- withCallback(cb) {
3482
- (0, async_1.callback)(this.root, this.options, cb);
3483
- }
3484
- sync() {
3485
- return (0, sync_1.sync)(this.root, this.options);
3486
- }
3487
- };
3488
- exports.APIBuilder = APIBuilder;
3489
- } });
3490
-
3491
- //#endregion
3492
- //#region node_modules/picomatch/lib/constants.js
3493
- var require_constants = __commonJS({ "node_modules/picomatch/lib/constants.js"(exports, module) {
3494
- const WIN_SLASH = "\\\\/";
3495
- const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
3496
- /**
3497
- * Posix glob regex
3498
- */
3499
- const DOT_LITERAL = "\\.";
3500
- const PLUS_LITERAL = "\\+";
3501
- const QMARK_LITERAL = "\\?";
3502
- const SLASH_LITERAL = "\\/";
3503
- const ONE_CHAR = "(?=.)";
3504
- const QMARK = "[^/]";
3505
- const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
3506
- const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
3507
- const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
3508
- const NO_DOT = `(?!${DOT_LITERAL})`;
3509
- const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
3510
- const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
3511
- const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
3512
- const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
3513
- const STAR = `${QMARK}*?`;
3514
- const SEP = "/";
3515
- const POSIX_CHARS = {
3516
- DOT_LITERAL,
3517
- PLUS_LITERAL,
3518
- QMARK_LITERAL,
3519
- SLASH_LITERAL,
3520
- ONE_CHAR,
3521
- QMARK,
3522
- END_ANCHOR,
3523
- DOTS_SLASH,
3524
- NO_DOT,
3525
- NO_DOTS,
3526
- NO_DOT_SLASH,
3527
- NO_DOTS_SLASH,
3528
- QMARK_NO_DOT,
3529
- STAR,
3530
- START_ANCHOR,
3531
- SEP
3532
- };
3533
- /**
3534
- * Windows glob regex
3535
- */
3536
- const WINDOWS_CHARS = {
3537
- ...POSIX_CHARS,
3538
- SLASH_LITERAL: `[${WIN_SLASH}]`,
3539
- QMARK: WIN_NO_SLASH,
3540
- STAR: `${WIN_NO_SLASH}*?`,
3541
- DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
3542
- NO_DOT: `(?!${DOT_LITERAL})`,
3543
- NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
3544
- NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
3545
- NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
3546
- QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
3547
- START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
3548
- END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
3549
- SEP: "\\"
3550
- };
3551
- /**
3552
- * POSIX Bracket Regex
3553
- */
3554
- const POSIX_REGEX_SOURCE$1 = {
3555
- alnum: "a-zA-Z0-9",
3556
- alpha: "a-zA-Z",
3557
- ascii: "\\x00-\\x7F",
3558
- blank: " \\t",
3559
- cntrl: "\\x00-\\x1F\\x7F",
3560
- digit: "0-9",
3561
- graph: "\\x21-\\x7E",
3562
- lower: "a-z",
3563
- print: "\\x20-\\x7E ",
3564
- punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
3565
- space: " \\t\\r\\n\\v\\f",
3566
- upper: "A-Z",
3567
- word: "A-Za-z0-9_",
3568
- xdigit: "A-Fa-f0-9"
3569
- };
3570
- module.exports = {
3571
- MAX_LENGTH: 1024 * 64,
3572
- POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
3573
- REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
3574
- REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
3575
- REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
3576
- REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
3577
- REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
3578
- REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
3579
- REPLACEMENTS: {
3580
- "***": "*",
3581
- "**/**": "**",
3582
- "**/**/**": "**"
3583
- },
3584
- CHAR_0: 48,
3585
- CHAR_9: 57,
3586
- CHAR_UPPERCASE_A: 65,
3587
- CHAR_LOWERCASE_A: 97,
3588
- CHAR_UPPERCASE_Z: 90,
3589
- CHAR_LOWERCASE_Z: 122,
3590
- CHAR_LEFT_PARENTHESES: 40,
3591
- CHAR_RIGHT_PARENTHESES: 41,
3592
- CHAR_ASTERISK: 42,
3593
- CHAR_AMPERSAND: 38,
3594
- CHAR_AT: 64,
3595
- CHAR_BACKWARD_SLASH: 92,
3596
- CHAR_CARRIAGE_RETURN: 13,
3597
- CHAR_CIRCUMFLEX_ACCENT: 94,
3598
- CHAR_COLON: 58,
3599
- CHAR_COMMA: 44,
3600
- CHAR_DOT: 46,
3601
- CHAR_DOUBLE_QUOTE: 34,
3602
- CHAR_EQUAL: 61,
3603
- CHAR_EXCLAMATION_MARK: 33,
3604
- CHAR_FORM_FEED: 12,
3605
- CHAR_FORWARD_SLASH: 47,
3606
- CHAR_GRAVE_ACCENT: 96,
3607
- CHAR_HASH: 35,
3608
- CHAR_HYPHEN_MINUS: 45,
3609
- CHAR_LEFT_ANGLE_BRACKET: 60,
3610
- CHAR_LEFT_CURLY_BRACE: 123,
3611
- CHAR_LEFT_SQUARE_BRACKET: 91,
3612
- CHAR_LINE_FEED: 10,
3613
- CHAR_NO_BREAK_SPACE: 160,
3614
- CHAR_PERCENT: 37,
3615
- CHAR_PLUS: 43,
3616
- CHAR_QUESTION_MARK: 63,
3617
- CHAR_RIGHT_ANGLE_BRACKET: 62,
3618
- CHAR_RIGHT_CURLY_BRACE: 125,
3619
- CHAR_RIGHT_SQUARE_BRACKET: 93,
3620
- CHAR_SEMICOLON: 59,
3621
- CHAR_SINGLE_QUOTE: 39,
3622
- CHAR_SPACE: 32,
3623
- CHAR_TAB: 9,
3624
- CHAR_UNDERSCORE: 95,
3625
- CHAR_VERTICAL_LINE: 124,
3626
- CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
3627
- extglobChars(chars) {
3628
- return {
3629
- "!": {
3630
- type: "negate",
3631
- open: "(?:(?!(?:",
3632
- close: `))${chars.STAR})`
3633
- },
3634
- "?": {
3635
- type: "qmark",
3636
- open: "(?:",
3637
- close: ")?"
3638
- },
3639
- "+": {
3640
- type: "plus",
3641
- open: "(?:",
3642
- close: ")+"
3643
- },
3644
- "*": {
3645
- type: "star",
3646
- open: "(?:",
3647
- close: ")*"
3648
- },
3649
- "@": {
3650
- type: "at",
3651
- open: "(?:",
3652
- close: ")"
3653
- }
3654
- };
3655
- },
3656
- globChars(win32) {
3657
- return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
3658
- }
3659
- };
3660
- } });
3661
-
3662
- //#endregion
3663
- //#region node_modules/picomatch/lib/utils.js
3664
- var require_utils = __commonJS({ "node_modules/picomatch/lib/utils.js"(exports) {
3665
- const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
3666
- exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
3667
- exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
3668
- exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
3669
- exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
3670
- exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
3671
- exports.isWindows = () => {
3672
- if (typeof navigator !== "undefined" && navigator.platform) {
3673
- const platform$1 = navigator.platform.toLowerCase();
3674
- return platform$1 === "win32" || platform$1 === "windows";
3675
- }
3676
- if (typeof process !== "undefined" && process.platform) return process.platform === "win32";
3677
- return false;
3678
- };
3679
- exports.removeBackslashes = (str) => {
3680
- return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
3681
- return match === "\\" ? "" : match;
3682
- });
3683
- };
3684
- exports.escapeLast = (input, char, lastIdx) => {
3685
- const idx = input.lastIndexOf(char, lastIdx);
3686
- if (idx === -1) return input;
3687
- if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
3688
- return `${input.slice(0, idx)}\\${input.slice(idx)}`;
3689
- };
3690
- exports.removePrefix = (input, state = {}) => {
3691
- let output = input;
3692
- if (output.startsWith("./")) {
3693
- output = output.slice(2);
3694
- state.prefix = "./";
3695
- }
3696
- return output;
3697
- };
3698
- exports.wrapOutput = (input, state = {}, options = {}) => {
3699
- const prepend = options.contains ? "" : "^";
3700
- const append = options.contains ? "" : "$";
3701
- let output = `${prepend}(?:${input})${append}`;
3702
- if (state.negated === true) output = `(?:^(?!${output}).*$)`;
3703
- return output;
3704
- };
3705
- exports.basename = (path$2, { windows } = {}) => {
3706
- const segs = path$2.split(windows ? /[\\/]/ : "/");
3707
- const last = segs[segs.length - 1];
3708
- if (last === "") return segs[segs.length - 2];
3709
- return last;
3710
- };
3711
- } });
3712
-
3713
- //#endregion
3714
- //#region node_modules/picomatch/lib/scan.js
3715
- var require_scan = __commonJS({ "node_modules/picomatch/lib/scan.js"(exports, module) {
3716
- const utils$3 = require_utils();
3717
- 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();
3718
- const isPathSeparator = (code) => {
3719
- return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
3720
- };
3721
- const depth = (token) => {
3722
- if (token.isPrefix !== true) token.depth = token.isGlobstar ? Infinity : 1;
3723
- };
3724
- /**
3725
- * Quickly scans a glob pattern and returns an object with a handful of
3726
- * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
3727
- * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
3728
- * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
3729
- *
3730
- * ```js
3731
- * const pm = require('picomatch');
3732
- * console.log(pm.scan('foo/bar/*.js'));
3733
- * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
3734
- * ```
3735
- * @param {String} `str`
3736
- * @param {Object} `options`
3737
- * @return {Object} Returns an object with tokens and regex source string.
3738
- * @api public
3739
- */
3740
- const scan$1 = (input, options) => {
3741
- const opts = options || {};
3742
- const length = input.length - 1;
3743
- const scanToEnd = opts.parts === true || opts.scanToEnd === true;
3744
- const slashes = [];
3745
- const tokens = [];
3746
- const parts = [];
3747
- let str = input;
3748
- let index = -1;
3749
- let start = 0;
3750
- let lastIndex = 0;
3751
- let isBrace = false;
3752
- let isBracket = false;
3753
- let isGlob = false;
3754
- let isExtglob = false;
3755
- let isGlobstar = false;
3756
- let braceEscaped = false;
3757
- let backslashes = false;
3758
- let negated = false;
3759
- let negatedExtglob = false;
3760
- let finished = false;
3761
- let braces = 0;
3762
- let prev;
3763
- let code;
3764
- let token = {
3765
- value: "",
3766
- depth: 0,
3767
- isGlob: false
3768
- };
3769
- const eos = () => index >= length;
3770
- const peek = () => str.charCodeAt(index + 1);
3771
- const advance = () => {
3772
- prev = code;
3773
- return str.charCodeAt(++index);
3774
- };
3775
- while (index < length) {
3776
- code = advance();
3777
- let next;
3778
- if (code === CHAR_BACKWARD_SLASH) {
3779
- backslashes = token.backslashes = true;
3780
- code = advance();
3781
- if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
3782
- continue;
3783
- }
3784
- if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
3785
- braces++;
3786
- while (eos() !== true && (code = advance())) {
3787
- if (code === CHAR_BACKWARD_SLASH) {
3788
- backslashes = token.backslashes = true;
3789
- advance();
3790
- continue;
3791
- }
3792
- if (code === CHAR_LEFT_CURLY_BRACE) {
3793
- braces++;
3794
- continue;
3795
- }
3796
- if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
3797
- isBrace = token.isBrace = true;
3798
- isGlob = token.isGlob = true;
3799
- finished = true;
3800
- if (scanToEnd === true) continue;
3801
- break;
3802
- }
3803
- if (braceEscaped !== true && code === CHAR_COMMA) {
3804
- isBrace = token.isBrace = true;
3805
- isGlob = token.isGlob = true;
3806
- finished = true;
3807
- if (scanToEnd === true) continue;
3808
- break;
3809
- }
3810
- if (code === CHAR_RIGHT_CURLY_BRACE) {
3811
- braces--;
3812
- if (braces === 0) {
3813
- braceEscaped = false;
3814
- isBrace = token.isBrace = true;
3815
- finished = true;
3816
- break;
3817
- }
3818
- }
3819
- }
3820
- if (scanToEnd === true) continue;
3821
- break;
3822
- }
3823
- if (code === CHAR_FORWARD_SLASH) {
3824
- slashes.push(index);
3825
- tokens.push(token);
3826
- token = {
3827
- value: "",
3828
- depth: 0,
3829
- isGlob: false
3830
- };
3831
- if (finished === true) continue;
3832
- if (prev === CHAR_DOT && index === start + 1) {
3833
- start += 2;
3834
- continue;
3835
- }
3836
- lastIndex = index + 1;
3837
- continue;
3838
- }
3839
- if (opts.noext !== true) {
3840
- const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
3841
- if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
3842
- isGlob = token.isGlob = true;
3843
- isExtglob = token.isExtglob = true;
3844
- finished = true;
3845
- if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
3846
- if (scanToEnd === true) {
3847
- while (eos() !== true && (code = advance())) {
3848
- if (code === CHAR_BACKWARD_SLASH) {
3849
- backslashes = token.backslashes = true;
3850
- code = advance();
3851
- continue;
3852
- }
3853
- if (code === CHAR_RIGHT_PARENTHESES) {
3854
- isGlob = token.isGlob = true;
3855
- finished = true;
3856
- break;
3857
- }
3858
- }
3859
- continue;
3860
- }
3861
- break;
3862
- }
3863
- }
3864
- if (code === CHAR_ASTERISK) {
3865
- if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
3866
- isGlob = token.isGlob = true;
3867
- finished = true;
3868
- if (scanToEnd === true) continue;
3869
- break;
3870
- }
3871
- if (code === CHAR_QUESTION_MARK) {
3872
- isGlob = token.isGlob = true;
3873
- finished = true;
3874
- if (scanToEnd === true) continue;
3875
- break;
3876
- }
3877
- if (code === CHAR_LEFT_SQUARE_BRACKET) {
3878
- while (eos() !== true && (next = advance())) {
3879
- if (next === CHAR_BACKWARD_SLASH) {
3880
- backslashes = token.backslashes = true;
3881
- advance();
3882
- continue;
3883
- }
3884
- if (next === CHAR_RIGHT_SQUARE_BRACKET) {
3885
- isBracket = token.isBracket = true;
3886
- isGlob = token.isGlob = true;
3887
- finished = true;
3888
- break;
3889
- }
3890
- }
3891
- if (scanToEnd === true) continue;
3892
- break;
3893
- }
3894
- if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
3895
- negated = token.negated = true;
3896
- start++;
3897
- continue;
3898
- }
3899
- if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
3900
- isGlob = token.isGlob = true;
3901
- if (scanToEnd === true) {
3902
- while (eos() !== true && (code = advance())) {
3903
- if (code === CHAR_LEFT_PARENTHESES) {
3904
- backslashes = token.backslashes = true;
3905
- code = advance();
3906
- continue;
3907
- }
3908
- if (code === CHAR_RIGHT_PARENTHESES) {
3909
- finished = true;
3910
- break;
3911
- }
3912
- }
3913
- continue;
3914
- }
3915
- break;
3916
- }
3917
- if (isGlob === true) {
3918
- finished = true;
3919
- if (scanToEnd === true) continue;
3920
- break;
3921
- }
3922
- }
3923
- if (opts.noext === true) {
3924
- isExtglob = false;
3925
- isGlob = false;
3926
- }
3927
- let base = str;
3928
- let prefix = "";
3929
- let glob$1 = "";
3930
- if (start > 0) {
3931
- prefix = str.slice(0, start);
3932
- str = str.slice(start);
3933
- lastIndex -= start;
3934
- }
3935
- if (base && isGlob === true && lastIndex > 0) {
3936
- base = str.slice(0, lastIndex);
3937
- glob$1 = str.slice(lastIndex);
3938
- } else if (isGlob === true) {
3939
- base = "";
3940
- glob$1 = str;
3941
- } else base = str;
3942
- if (base && base !== "" && base !== "/" && base !== str) {
3943
- if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
3944
- }
3945
- if (opts.unescape === true) {
3946
- if (glob$1) glob$1 = utils$3.removeBackslashes(glob$1);
3947
- if (base && backslashes === true) base = utils$3.removeBackslashes(base);
3948
- }
3949
- const state = {
3950
- prefix,
3951
- input,
3952
- start,
3953
- base,
3954
- glob: glob$1,
3955
- isBrace,
3956
- isBracket,
3957
- isGlob,
3958
- isExtglob,
3959
- isGlobstar,
3960
- negated,
3961
- negatedExtglob
3962
- };
3963
- if (opts.tokens === true) {
3964
- state.maxDepth = 0;
3965
- if (!isPathSeparator(code)) tokens.push(token);
3966
- state.tokens = tokens;
3967
- }
3968
- if (opts.parts === true || opts.tokens === true) {
3969
- let prevIndex;
3970
- for (let idx = 0; idx < slashes.length; idx++) {
3971
- const n$1 = prevIndex ? prevIndex + 1 : start;
3972
- const i$1 = slashes[idx];
3973
- const value = input.slice(n$1, i$1);
3974
- if (opts.tokens) {
3975
- if (idx === 0 && start !== 0) {
3976
- tokens[idx].isPrefix = true;
3977
- tokens[idx].value = prefix;
3978
- } else tokens[idx].value = value;
3979
- depth(tokens[idx]);
3980
- state.maxDepth += tokens[idx].depth;
3981
- }
3982
- if (idx !== 0 || value !== "") parts.push(value);
3983
- prevIndex = i$1;
3984
- }
3985
- if (prevIndex && prevIndex + 1 < input.length) {
3986
- const value = input.slice(prevIndex + 1);
3987
- parts.push(value);
3988
- if (opts.tokens) {
3989
- tokens[tokens.length - 1].value = value;
3990
- depth(tokens[tokens.length - 1]);
3991
- state.maxDepth += tokens[tokens.length - 1].depth;
3992
- }
3993
- }
3994
- state.slashes = slashes;
3995
- state.parts = parts;
3996
- }
3997
- return state;
3998
- };
3999
- module.exports = scan$1;
4000
- } });
4001
-
4002
- //#endregion
4003
- //#region node_modules/picomatch/lib/parse.js
4004
- var require_parse = __commonJS({ "node_modules/picomatch/lib/parse.js"(exports, module) {
4005
- const constants$1 = require_constants();
4006
- const utils$2 = require_utils();
4007
- /**
4008
- * Constants
4009
- */
4010
- const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants$1;
4011
- /**
4012
- * Helpers
4013
- */
4014
- const expandRange = (args, options) => {
4015
- if (typeof options.expandRange === "function") return options.expandRange(...args, options);
4016
- args.sort();
4017
- const value = `[${args.join("-")}]`;
4018
- try {
4019
- new RegExp(value);
4020
- } catch (ex) {
4021
- return args.map((v) => utils$2.escapeRegex(v)).join("..");
4022
- }
4023
- return value;
4024
- };
4025
- /**
4026
- * Create the message for a syntax error
4027
- */
4028
- const syntaxError = (type, char) => {
4029
- return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
4030
- };
4031
- /**
4032
- * Parse the given input string.
4033
- * @param {String} input
4034
- * @param {Object} options
4035
- * @return {Object}
4036
- */
4037
- const parse$1 = (input, options) => {
4038
- if (typeof input !== "string") throw new TypeError("Expected a string");
4039
- input = REPLACEMENTS[input] || input;
4040
- const opts = { ...options };
4041
- const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
4042
- let len = input.length;
4043
- if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
4044
- const bos = {
4045
- type: "bos",
4046
- value: "",
4047
- output: opts.prepend || ""
4048
- };
4049
- const tokens = [bos];
4050
- const capture = opts.capture ? "" : "?:";
4051
- const PLATFORM_CHARS = constants$1.globChars(opts.windows);
4052
- const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
4053
- 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$1, NO_DOT_SLASH: NO_DOT_SLASH$1, NO_DOTS_SLASH: NO_DOTS_SLASH$1, QMARK: QMARK$1, QMARK_NO_DOT: QMARK_NO_DOT$1, STAR: STAR$1, START_ANCHOR: START_ANCHOR$1 } = PLATFORM_CHARS;
4054
- const globstar = (opts$1) => {
4055
- return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
4056
- };
4057
- const nodot = opts.dot ? "" : NO_DOT$1;
4058
- const qmarkNoDot = opts.dot ? QMARK$1 : QMARK_NO_DOT$1;
4059
- let star = opts.bash === true ? globstar(opts) : STAR$1;
4060
- if (opts.capture) star = `(${star})`;
4061
- if (typeof opts.noext === "boolean") opts.noextglob = opts.noext;
4062
- const state = {
4063
- input,
4064
- index: -1,
4065
- start: 0,
4066
- dot: opts.dot === true,
4067
- consumed: "",
4068
- output: "",
4069
- prefix: "",
4070
- backtrack: false,
4071
- negated: false,
4072
- brackets: 0,
4073
- braces: 0,
4074
- parens: 0,
4075
- quotes: 0,
4076
- globstar: false,
4077
- tokens
4078
- };
4079
- input = utils$2.removePrefix(input, state);
4080
- len = input.length;
4081
- const extglobs = [];
4082
- const braces = [];
4083
- const stack = [];
4084
- let prev = bos;
4085
- let value;
4086
- /**
4087
- * Tokenizing helpers
4088
- */
4089
- const eos = () => state.index === len - 1;
4090
- const peek = state.peek = (n$1 = 1) => input[state.index + n$1];
4091
- const advance = state.advance = () => input[++state.index] || "";
4092
- const remaining = () => input.slice(state.index + 1);
4093
- const consume = (value$1 = "", num = 0) => {
4094
- state.consumed += value$1;
4095
- state.index += num;
4096
- };
4097
- const append = (token) => {
4098
- state.output += token.output != null ? token.output : token.value;
4099
- consume(token.value);
4100
- };
4101
- const negate = () => {
4102
- let count = 1;
4103
- while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
4104
- advance();
4105
- state.start++;
4106
- count++;
4107
- }
4108
- if (count % 2 === 0) return false;
4109
- state.negated = true;
4110
- state.start++;
4111
- return true;
4112
- };
4113
- const increment = (type) => {
4114
- state[type]++;
4115
- stack.push(type);
4116
- };
4117
- const decrement = (type) => {
4118
- state[type]--;
4119
- stack.pop();
4120
- };
4121
- /**
4122
- * Push tokens onto the tokens array. This helper speeds up
4123
- * tokenizing by 1) helping us avoid backtracking as much as possible,
4124
- * and 2) helping us avoid creating extra tokens when consecutive
4125
- * characters are plain text. This improves performance and simplifies
4126
- * lookbehinds.
4127
- */
4128
- const push = (tok) => {
4129
- if (prev.type === "globstar") {
4130
- const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
4131
- const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
4132
- if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
4133
- state.output = state.output.slice(0, -prev.output.length);
4134
- prev.type = "star";
4135
- prev.value = "*";
4136
- prev.output = star;
4137
- state.output += prev.output;
4138
- }
4139
- }
4140
- if (extglobs.length && tok.type !== "paren") extglobs[extglobs.length - 1].inner += tok.value;
4141
- if (tok.value || tok.output) append(tok);
4142
- if (prev && prev.type === "text" && tok.type === "text") {
4143
- prev.output = (prev.output || prev.value) + tok.value;
4144
- prev.value += tok.value;
4145
- return;
4146
- }
4147
- tok.prev = prev;
4148
- tokens.push(tok);
4149
- prev = tok;
4150
- };
4151
- const extglobOpen = (type, value$1) => {
4152
- const token = {
4153
- ...EXTGLOB_CHARS[value$1],
4154
- conditions: 1,
4155
- inner: ""
4156
- };
4157
- token.prev = prev;
4158
- token.parens = state.parens;
4159
- token.output = state.output;
4160
- const output = (opts.capture ? "(" : "") + token.open;
4161
- increment("parens");
4162
- push({
4163
- type,
4164
- value: value$1,
4165
- output: state.output ? "" : ONE_CHAR$1
4166
- });
4167
- push({
4168
- type: "paren",
4169
- extglob: true,
4170
- value: advance(),
4171
- output
4172
- });
4173
- extglobs.push(token);
4174
- };
4175
- const extglobClose = (token) => {
4176
- let output = token.close + (opts.capture ? ")" : "");
4177
- let rest;
4178
- if (token.type === "negate") {
4179
- let extglobStar = star;
4180
- if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
4181
- if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
4182
- if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
4183
- const expression = parse$1(rest, {
4184
- ...options,
4185
- fastpaths: false
4186
- }).output;
4187
- output = token.close = `)${expression})${extglobStar})`;
4188
- }
4189
- if (token.prev.type === "bos") state.negatedExtglob = true;
4190
- }
4191
- push({
4192
- type: "paren",
4193
- extglob: true,
4194
- value,
4195
- output
4196
- });
4197
- decrement("parens");
4198
- };
4199
- /**
4200
- * Fast paths
4201
- */
4202
- if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
4203
- let backslashes = false;
4204
- let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
4205
- if (first === "\\") {
4206
- backslashes = true;
4207
- return m;
4208
- }
4209
- if (first === "?") {
4210
- if (esc) return esc + first + (rest ? QMARK$1.repeat(rest.length) : "");
4211
- if (index === 0) return qmarkNoDot + (rest ? QMARK$1.repeat(rest.length) : "");
4212
- return QMARK$1.repeat(chars.length);
4213
- }
4214
- if (first === ".") return DOT_LITERAL$1.repeat(chars.length);
4215
- if (first === "*") {
4216
- if (esc) return esc + first + (rest ? star : "");
4217
- return star;
4218
- }
4219
- return esc ? m : `\\${m}`;
4220
- });
4221
- if (backslashes === true) if (opts.unescape === true) output = output.replace(/\\/g, "");
4222
- else output = output.replace(/\\+/g, (m) => {
4223
- return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
4224
- });
4225
- if (output === input && opts.contains === true) {
4226
- state.output = input;
4227
- return state;
4228
- }
4229
- state.output = utils$2.wrapOutput(output, state, options);
4230
- return state;
4231
- }
4232
- /**
4233
- * Tokenize input until we reach end-of-string
4234
- */
4235
- while (!eos()) {
4236
- value = advance();
4237
- if (value === "\0") continue;
4238
- /**
4239
- * Escaped characters
4240
- */
4241
- if (value === "\\") {
4242
- const next = peek();
4243
- if (next === "/" && opts.bash !== true) continue;
4244
- if (next === "." || next === ";") continue;
4245
- if (!next) {
4246
- value += "\\";
4247
- push({
4248
- type: "text",
4249
- value
4250
- });
4251
- continue;
4252
- }
4253
- const match = /^\\+/.exec(remaining());
4254
- let slashes = 0;
4255
- if (match && match[0].length > 2) {
4256
- slashes = match[0].length;
4257
- state.index += slashes;
4258
- if (slashes % 2 !== 0) value += "\\";
4259
- }
4260
- if (opts.unescape === true) value = advance();
4261
- else value += advance();
4262
- if (state.brackets === 0) {
4263
- push({
4264
- type: "text",
4265
- value
4266
- });
4267
- continue;
4268
- }
4269
- }
4270
- /**
4271
- * If we're inside a regex character class, continue
4272
- * until we reach the closing bracket.
4273
- */
4274
- if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
4275
- if (opts.posix !== false && value === ":") {
4276
- const inner = prev.value.slice(1);
4277
- if (inner.includes("[")) {
4278
- prev.posix = true;
4279
- if (inner.includes(":")) {
4280
- const idx = prev.value.lastIndexOf("[");
4281
- const pre = prev.value.slice(0, idx);
4282
- const rest$1 = prev.value.slice(idx + 2);
4283
- const posix$1 = POSIX_REGEX_SOURCE[rest$1];
4284
- if (posix$1) {
4285
- prev.value = pre + posix$1;
4286
- state.backtrack = true;
4287
- advance();
4288
- if (!bos.output && tokens.indexOf(prev) === 1) bos.output = ONE_CHAR$1;
4289
- continue;
4290
- }
4291
- }
4292
- }
4293
- }
4294
- if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") value = `\\${value}`;
4295
- if (value === "]" && (prev.value === "[" || prev.value === "[^")) value = `\\${value}`;
4296
- if (opts.posix === true && value === "!" && prev.value === "[") value = "^";
4297
- prev.value += value;
4298
- append({ value });
4299
- continue;
4300
- }
4301
- /**
4302
- * If we're inside a quoted string, continue
4303
- * until we reach the closing double quote.
4304
- */
4305
- if (state.quotes === 1 && value !== "\"") {
4306
- value = utils$2.escapeRegex(value);
4307
- prev.value += value;
4308
- append({ value });
4309
- continue;
4310
- }
4311
- /**
4312
- * Double quotes
4313
- */
4314
- if (value === "\"") {
4315
- state.quotes = state.quotes === 1 ? 0 : 1;
4316
- if (opts.keepQuotes === true) push({
4317
- type: "text",
4318
- value
4319
- });
4320
- continue;
4321
- }
4322
- /**
4323
- * Parentheses
4324
- */
4325
- if (value === "(") {
4326
- increment("parens");
4327
- push({
4328
- type: "paren",
4329
- value
4330
- });
4331
- continue;
4332
- }
4333
- if (value === ")") {
4334
- if (state.parens === 0 && opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "("));
4335
- const extglob = extglobs[extglobs.length - 1];
4336
- if (extglob && state.parens === extglob.parens + 1) {
4337
- extglobClose(extglobs.pop());
4338
- continue;
4339
- }
4340
- push({
4341
- type: "paren",
4342
- value,
4343
- output: state.parens ? ")" : "\\)"
4344
- });
4345
- decrement("parens");
4346
- continue;
4347
- }
4348
- /**
4349
- * Square brackets
4350
- */
4351
- if (value === "[") {
4352
- if (opts.nobracket === true || !remaining().includes("]")) {
4353
- if (opts.nobracket !== true && opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
4354
- value = `\\${value}`;
4355
- } else increment("brackets");
4356
- push({
4357
- type: "bracket",
4358
- value
4359
- });
4360
- continue;
4361
- }
4362
- if (value === "]") {
4363
- if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
4364
- push({
4365
- type: "text",
4366
- value,
4367
- output: `\\${value}`
4368
- });
4369
- continue;
4370
- }
4371
- if (state.brackets === 0) {
4372
- if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "["));
4373
- push({
4374
- type: "text",
4375
- value,
4376
- output: `\\${value}`
4377
- });
4378
- continue;
4379
- }
4380
- decrement("brackets");
4381
- const prevValue = prev.value.slice(1);
4382
- if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) value = `/${value}`;
4383
- prev.value += value;
4384
- append({ value });
4385
- if (opts.literalBrackets === false || utils$2.hasRegexChars(prevValue)) continue;
4386
- const escaped = utils$2.escapeRegex(prev.value);
4387
- state.output = state.output.slice(0, -prev.value.length);
4388
- if (opts.literalBrackets === true) {
4389
- state.output += escaped;
4390
- prev.value = escaped;
4391
- continue;
4392
- }
4393
- prev.value = `(${capture}${escaped}|${prev.value})`;
4394
- state.output += prev.value;
4395
- continue;
4396
- }
4397
- /**
4398
- * Braces
4399
- */
4400
- if (value === "{" && opts.nobrace !== true) {
4401
- increment("braces");
4402
- const open = {
4403
- type: "brace",
4404
- value,
4405
- output: "(",
4406
- outputIndex: state.output.length,
4407
- tokensIndex: state.tokens.length
4408
- };
4409
- braces.push(open);
4410
- push(open);
4411
- continue;
4412
- }
4413
- if (value === "}") {
4414
- const brace = braces[braces.length - 1];
4415
- if (opts.nobrace === true || !brace) {
4416
- push({
4417
- type: "text",
4418
- value,
4419
- output: value
4420
- });
4421
- continue;
4422
- }
4423
- let output = ")";
4424
- if (brace.dots === true) {
4425
- const arr = tokens.slice();
4426
- const range = [];
4427
- for (let i$1 = arr.length - 1; i$1 >= 0; i$1--) {
4428
- tokens.pop();
4429
- if (arr[i$1].type === "brace") break;
4430
- if (arr[i$1].type !== "dots") range.unshift(arr[i$1].value);
4431
- }
4432
- output = expandRange(range, opts);
4433
- state.backtrack = true;
4434
- }
4435
- if (brace.comma !== true && brace.dots !== true) {
4436
- const out = state.output.slice(0, brace.outputIndex);
4437
- const toks = state.tokens.slice(brace.tokensIndex);
4438
- brace.value = brace.output = "\\{";
4439
- value = output = "\\}";
4440
- state.output = out;
4441
- for (const t$1 of toks) state.output += t$1.output || t$1.value;
4442
- }
4443
- push({
4444
- type: "brace",
4445
- value,
4446
- output
4447
- });
4448
- decrement("braces");
4449
- braces.pop();
4450
- continue;
4451
- }
4452
- /**
4453
- * Pipes
4454
- */
4455
- if (value === "|") {
4456
- if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
4457
- push({
4458
- type: "text",
4459
- value
4460
- });
4461
- continue;
4462
- }
4463
- /**
4464
- * Commas
4465
- */
4466
- if (value === ",") {
4467
- let output = value;
4468
- const brace = braces[braces.length - 1];
4469
- if (brace && stack[stack.length - 1] === "braces") {
4470
- brace.comma = true;
4471
- output = "|";
4472
- }
4473
- push({
4474
- type: "comma",
4475
- value,
4476
- output
4477
- });
4478
- continue;
4479
- }
4480
- /**
4481
- * Slashes
4482
- */
4483
- if (value === "/") {
4484
- if (prev.type === "dot" && state.index === state.start + 1) {
4485
- state.start = state.index + 1;
4486
- state.consumed = "";
4487
- state.output = "";
4488
- tokens.pop();
4489
- prev = bos;
4490
- continue;
4491
- }
4492
- push({
4493
- type: "slash",
4494
- value,
4495
- output: SLASH_LITERAL$1
4496
- });
4497
- continue;
4498
- }
4499
- /**
4500
- * Dots
4501
- */
4502
- if (value === ".") {
4503
- if (state.braces > 0 && prev.type === "dot") {
4504
- if (prev.value === ".") prev.output = DOT_LITERAL$1;
4505
- const brace = braces[braces.length - 1];
4506
- prev.type = "dots";
4507
- prev.output += value;
4508
- prev.value += value;
4509
- brace.dots = true;
4510
- continue;
4511
- }
4512
- if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
4513
- push({
4514
- type: "text",
4515
- value,
4516
- output: DOT_LITERAL$1
4517
- });
4518
- continue;
4519
- }
4520
- push({
4521
- type: "dot",
4522
- value,
4523
- output: DOT_LITERAL$1
4524
- });
4525
- continue;
4526
- }
4527
- /**
4528
- * Question marks
4529
- */
4530
- if (value === "?") {
4531
- const isGroup = prev && prev.value === "(";
4532
- if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
4533
- extglobOpen("qmark", value);
4534
- continue;
4535
- }
4536
- if (prev && prev.type === "paren") {
4537
- const next = peek();
4538
- let output = value;
4539
- if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
4540
- push({
4541
- type: "text",
4542
- value,
4543
- output
4544
- });
4545
- continue;
4546
- }
4547
- if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
4548
- push({
4549
- type: "qmark",
4550
- value,
4551
- output: QMARK_NO_DOT$1
4552
- });
4553
- continue;
4554
- }
4555
- push({
4556
- type: "qmark",
4557
- value,
4558
- output: QMARK$1
4559
- });
4560
- continue;
4561
- }
4562
- /**
4563
- * Exclamation
4564
- */
4565
- if (value === "!") {
4566
- if (opts.noextglob !== true && peek() === "(") {
4567
- if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
4568
- extglobOpen("negate", value);
4569
- continue;
4570
- }
4571
- }
4572
- if (opts.nonegate !== true && state.index === 0) {
4573
- negate();
4574
- continue;
4575
- }
4576
- }
4577
- /**
4578
- * Plus
4579
- */
4580
- if (value === "+") {
4581
- if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
4582
- extglobOpen("plus", value);
4583
- continue;
4584
- }
4585
- if (prev && prev.value === "(" || opts.regex === false) {
4586
- push({
4587
- type: "plus",
4588
- value,
4589
- output: PLUS_LITERAL$1
4590
- });
4591
- continue;
4592
- }
4593
- if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
4594
- push({
4595
- type: "plus",
4596
- value
4597
- });
4598
- continue;
4599
- }
4600
- push({
4601
- type: "plus",
4602
- value: PLUS_LITERAL$1
4603
- });
4604
- continue;
4605
- }
4606
- /**
4607
- * Plain text
4608
- */
4609
- if (value === "@") {
4610
- if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
4611
- push({
4612
- type: "at",
4613
- extglob: true,
4614
- value,
4615
- output: ""
4616
- });
4617
- continue;
4618
- }
4619
- push({
4620
- type: "text",
4621
- value
4622
- });
4623
- continue;
4624
- }
4625
- /**
4626
- * Plain text
4627
- */
4628
- if (value !== "*") {
4629
- if (value === "$" || value === "^") value = `\\${value}`;
4630
- const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
4631
- if (match) {
4632
- value += match[0];
4633
- state.index += match[0].length;
4634
- }
4635
- push({
4636
- type: "text",
4637
- value
4638
- });
4639
- continue;
4640
- }
4641
- /**
4642
- * Stars
4643
- */
4644
- if (prev && (prev.type === "globstar" || prev.star === true)) {
4645
- prev.type = "star";
4646
- prev.star = true;
4647
- prev.value += value;
4648
- prev.output = star;
4649
- state.backtrack = true;
4650
- state.globstar = true;
4651
- consume(value);
4652
- continue;
4653
- }
4654
- let rest = remaining();
4655
- if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
4656
- extglobOpen("star", value);
4657
- continue;
4658
- }
4659
- if (prev.type === "star") {
4660
- if (opts.noglobstar === true) {
4661
- consume(value);
4662
- continue;
4663
- }
4664
- const prior = prev.prev;
4665
- const before = prior.prev;
4666
- const isStart = prior.type === "slash" || prior.type === "bos";
4667
- const afterStar = before && (before.type === "star" || before.type === "globstar");
4668
- if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
4669
- push({
4670
- type: "star",
4671
- value,
4672
- output: ""
4673
- });
4674
- continue;
4675
- }
4676
- const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
4677
- const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
4678
- if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
4679
- push({
4680
- type: "star",
4681
- value,
4682
- output: ""
4683
- });
4684
- continue;
4685
- }
4686
- while (rest.slice(0, 3) === "/**") {
4687
- const after = input[state.index + 4];
4688
- if (after && after !== "/") break;
4689
- rest = rest.slice(3);
4690
- consume("/**", 3);
4691
- }
4692
- if (prior.type === "bos" && eos()) {
4693
- prev.type = "globstar";
4694
- prev.value += value;
4695
- prev.output = globstar(opts);
4696
- state.output = prev.output;
4697
- state.globstar = true;
4698
- consume(value);
4699
- continue;
4700
- }
4701
- if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
4702
- state.output = state.output.slice(0, -(prior.output + prev.output).length);
4703
- prior.output = `(?:${prior.output}`;
4704
- prev.type = "globstar";
4705
- prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
4706
- prev.value += value;
4707
- state.globstar = true;
4708
- state.output += prior.output + prev.output;
4709
- consume(value);
4710
- continue;
4711
- }
4712
- if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
4713
- const end = rest[1] !== void 0 ? "|$" : "";
4714
- state.output = state.output.slice(0, -(prior.output + prev.output).length);
4715
- prior.output = `(?:${prior.output}`;
4716
- prev.type = "globstar";
4717
- prev.output = `${globstar(opts)}${SLASH_LITERAL$1}|${SLASH_LITERAL$1}${end})`;
4718
- prev.value += value;
4719
- state.output += prior.output + prev.output;
4720
- state.globstar = true;
4721
- consume(value + advance());
4722
- push({
4723
- type: "slash",
4724
- value: "/",
4725
- output: ""
4726
- });
4727
- continue;
4728
- }
4729
- if (prior.type === "bos" && rest[0] === "/") {
4730
- prev.type = "globstar";
4731
- prev.value += value;
4732
- prev.output = `(?:^|${SLASH_LITERAL$1}|${globstar(opts)}${SLASH_LITERAL$1})`;
4733
- state.output = prev.output;
4734
- state.globstar = true;
4735
- consume(value + advance());
4736
- push({
4737
- type: "slash",
4738
- value: "/",
4739
- output: ""
4740
- });
4741
- continue;
4742
- }
4743
- state.output = state.output.slice(0, -prev.output.length);
4744
- prev.type = "globstar";
4745
- prev.output = globstar(opts);
4746
- prev.value += value;
4747
- state.output += prev.output;
4748
- state.globstar = true;
4749
- consume(value);
4750
- continue;
4751
- }
4752
- const token = {
4753
- type: "star",
4754
- value,
4755
- output: star
4756
- };
4757
- if (opts.bash === true) {
4758
- token.output = ".*?";
4759
- if (prev.type === "bos" || prev.type === "slash") token.output = nodot + token.output;
4760
- push(token);
4761
- continue;
4762
- }
4763
- if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
4764
- token.output = value;
4765
- push(token);
4766
- continue;
4767
- }
4768
- if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
4769
- if (prev.type === "dot") {
4770
- state.output += NO_DOT_SLASH$1;
4771
- prev.output += NO_DOT_SLASH$1;
4772
- } else if (opts.dot === true) {
4773
- state.output += NO_DOTS_SLASH$1;
4774
- prev.output += NO_DOTS_SLASH$1;
4775
- } else {
4776
- state.output += nodot;
4777
- prev.output += nodot;
4778
- }
4779
- if (peek() !== "*") {
4780
- state.output += ONE_CHAR$1;
4781
- prev.output += ONE_CHAR$1;
4782
- }
4783
- }
4784
- push(token);
4785
- }
4786
- while (state.brackets > 0) {
4787
- if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
4788
- state.output = utils$2.escapeLast(state.output, "[");
4789
- decrement("brackets");
4790
- }
4791
- while (state.parens > 0) {
4792
- if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
4793
- state.output = utils$2.escapeLast(state.output, "(");
4794
- decrement("parens");
4795
- }
4796
- while (state.braces > 0) {
4797
- if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
4798
- state.output = utils$2.escapeLast(state.output, "{");
4799
- decrement("braces");
4800
- }
4801
- if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) push({
4802
- type: "maybe_slash",
4803
- value: "",
4804
- output: `${SLASH_LITERAL$1}?`
4805
- });
4806
- if (state.backtrack === true) {
4807
- state.output = "";
4808
- for (const token of state.tokens) {
4809
- state.output += token.output != null ? token.output : token.value;
4810
- if (token.suffix) state.output += token.suffix;
4811
- }
4812
- }
4813
- return state;
4814
- };
4815
- /**
4816
- * Fast paths for creating regular expressions for common glob patterns.
4817
- * This can significantly speed up processing and has very little downside
4818
- * impact when none of the fast paths match.
4819
- */
4820
- parse$1.fastpaths = (input, options) => {
4821
- const opts = { ...options };
4822
- const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
4823
- const len = input.length;
4824
- if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
4825
- input = REPLACEMENTS[input] || input;
4826
- const { DOT_LITERAL: DOT_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT: NO_DOT$1, NO_DOTS: NO_DOTS$1, NO_DOTS_SLASH: NO_DOTS_SLASH$1, STAR: STAR$1, START_ANCHOR: START_ANCHOR$1 } = constants$1.globChars(opts.windows);
4827
- const nodot = opts.dot ? NO_DOTS$1 : NO_DOT$1;
4828
- const slashDot = opts.dot ? NO_DOTS_SLASH$1 : NO_DOT$1;
4829
- const capture = opts.capture ? "" : "?:";
4830
- const state = {
4831
- negated: false,
4832
- prefix: ""
4833
- };
4834
- let star = opts.bash === true ? ".*?" : STAR$1;
4835
- if (opts.capture) star = `(${star})`;
4836
- const globstar = (opts$1) => {
4837
- if (opts$1.noglobstar === true) return star;
4838
- return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
4839
- };
4840
- const create$1 = (str) => {
4841
- switch (str) {
4842
- case "*": return `${nodot}${ONE_CHAR$1}${star}`;
4843
- case ".*": return `${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
4844
- case "*.*": return `${nodot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
4845
- case "*/*": return `${nodot}${star}${SLASH_LITERAL$1}${ONE_CHAR$1}${slashDot}${star}`;
4846
- case "**": return nodot + globstar(opts);
4847
- case "**/*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${ONE_CHAR$1}${star}`;
4848
- case "**/*.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
4849
- case "**/.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
4850
- default: {
4851
- const match = /^(.*?)\.(\w+)$/.exec(str);
4852
- if (!match) return;
4853
- const source$1 = create$1(match[1]);
4854
- if (!source$1) return;
4855
- return source$1 + DOT_LITERAL$1 + match[2];
4856
- }
4857
- }
4858
- };
4859
- const output = utils$2.removePrefix(input, state);
4860
- let source = create$1(output);
4861
- if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL$1}?`;
4862
- return source;
4863
- };
4864
- module.exports = parse$1;
4865
- } });
4866
-
4867
- //#endregion
4868
- //#region node_modules/picomatch/lib/picomatch.js
4869
- var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"(exports, module) {
4870
- const scan = require_scan();
4871
- const parse = require_parse();
4872
- const utils$1 = require_utils();
4873
- const constants = require_constants();
4874
- const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
4875
- /**
4876
- * Creates a matcher function from one or more glob patterns. The
4877
- * returned function takes a string to match as its first argument,
4878
- * and returns true if the string is a match. The returned matcher
4879
- * function also takes a boolean as the second argument that, when true,
4880
- * returns an object with additional information.
4881
- *
4882
- * ```js
4883
- * const picomatch = require('picomatch');
4884
- * // picomatch(glob[, options]);
4885
- *
4886
- * const isMatch = picomatch('*.!(*a)');
4887
- * console.log(isMatch('a.a')); //=> false
4888
- * console.log(isMatch('a.b')); //=> true
4889
- * ```
4890
- * @name picomatch
4891
- * @param {String|Array} `globs` One or more glob patterns.
4892
- * @param {Object=} `options`
4893
- * @return {Function=} Returns a matcher function.
4894
- * @api public
4895
- */
4896
- const picomatch$2 = (glob$1, options, returnState = false) => {
4897
- if (Array.isArray(glob$1)) {
4898
- const fns = glob$1.map((input) => picomatch$2(input, options, returnState));
4899
- const arrayMatcher = (str) => {
4900
- for (const isMatch of fns) {
4901
- const state$1 = isMatch(str);
4902
- if (state$1) return state$1;
4903
- }
4904
- return false;
4905
- };
4906
- return arrayMatcher;
4907
- }
4908
- const isState = isObject(glob$1) && glob$1.tokens && glob$1.input;
4909
- if (glob$1 === "" || typeof glob$1 !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
4910
- const opts = options || {};
4911
- const posix$1 = opts.windows;
4912
- const regex$2 = isState ? picomatch$2.compileRe(glob$1, options) : picomatch$2.makeRe(glob$1, options, false, true);
4913
- const state = regex$2.state;
4914
- delete regex$2.state;
4915
- let isIgnored = () => false;
4916
- if (opts.ignore) {
4917
- const ignoreOpts = {
4918
- ...options,
4919
- ignore: null,
4920
- onMatch: null,
4921
- onResult: null
4922
- };
4923
- isIgnored = picomatch$2(opts.ignore, ignoreOpts, returnState);
4924
- }
4925
- const matcher = (input, returnObject = false) => {
4926
- const { isMatch, match, output } = picomatch$2.test(input, regex$2, options, {
4927
- glob: glob$1,
4928
- posix: posix$1
4929
- });
4930
- const result = {
4931
- glob: glob$1,
4932
- state,
4933
- regex: regex$2,
4934
- posix: posix$1,
4935
- input,
4936
- output,
4937
- match,
4938
- isMatch
4939
- };
4940
- if (typeof opts.onResult === "function") opts.onResult(result);
4941
- if (isMatch === false) {
4942
- result.isMatch = false;
4943
- return returnObject ? result : false;
4944
- }
4945
- if (isIgnored(input)) {
4946
- if (typeof opts.onIgnore === "function") opts.onIgnore(result);
4947
- result.isMatch = false;
4948
- return returnObject ? result : false;
4949
- }
4950
- if (typeof opts.onMatch === "function") opts.onMatch(result);
4951
- return returnObject ? result : true;
4952
- };
4953
- if (returnState) matcher.state = state;
4954
- return matcher;
4955
- };
4956
- /**
4957
- * Test `input` with the given `regex`. This is used by the main
4958
- * `picomatch()` function to test the input string.
4959
- *
4960
- * ```js
4961
- * const picomatch = require('picomatch');
4962
- * // picomatch.test(input, regex[, options]);
4963
- *
4964
- * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
4965
- * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
4966
- * ```
4967
- * @param {String} `input` String to test.
4968
- * @param {RegExp} `regex`
4969
- * @return {Object} Returns an object with matching info.
4970
- * @api public
4971
- */
4972
- picomatch$2.test = (input, regex$2, options, { glob: glob$1, posix: posix$1 } = {}) => {
4973
- if (typeof input !== "string") throw new TypeError("Expected input to be a string");
4974
- if (input === "") return {
4975
- isMatch: false,
4976
- output: ""
4977
- };
4978
- const opts = options || {};
4979
- const format = opts.format || (posix$1 ? utils$1.toPosixSlashes : null);
4980
- let match = input === glob$1;
4981
- let output = match && format ? format(input) : input;
4982
- if (match === false) {
4983
- output = format ? format(input) : input;
4984
- match = output === glob$1;
4985
- }
4986
- if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch$2.matchBase(input, regex$2, options, posix$1);
4987
- else match = regex$2.exec(output);
4988
- return {
4989
- isMatch: Boolean(match),
4990
- match,
4991
- output
4992
- };
4993
- };
4994
- /**
4995
- * Match the basename of a filepath.
4996
- *
4997
- * ```js
4998
- * const picomatch = require('picomatch');
4999
- * // picomatch.matchBase(input, glob[, options]);
5000
- * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
5001
- * ```
5002
- * @param {String} `input` String to test.
5003
- * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
5004
- * @return {Boolean}
5005
- * @api public
5006
- */
5007
- picomatch$2.matchBase = (input, glob$1, options) => {
5008
- const regex$2 = glob$1 instanceof RegExp ? glob$1 : picomatch$2.makeRe(glob$1, options);
5009
- return regex$2.test(utils$1.basename(input));
5010
- };
5011
- /**
5012
- * Returns true if **any** of the given glob `patterns` match the specified `string`.
5013
- *
5014
- * ```js
5015
- * const picomatch = require('picomatch');
5016
- * // picomatch.isMatch(string, patterns[, options]);
5017
- *
5018
- * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
5019
- * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
5020
- * ```
5021
- * @param {String|Array} str The string to test.
5022
- * @param {String|Array} patterns One or more glob patterns to use for matching.
5023
- * @param {Object} [options] See available [options](#options).
5024
- * @return {Boolean} Returns true if any patterns match `str`
5025
- * @api public
5026
- */
5027
- picomatch$2.isMatch = (str, patterns, options) => picomatch$2(patterns, options)(str);
5028
- /**
5029
- * Parse a glob pattern to create the source string for a regular
5030
- * expression.
5031
- *
5032
- * ```js
5033
- * const picomatch = require('picomatch');
5034
- * const result = picomatch.parse(pattern[, options]);
5035
- * ```
5036
- * @param {String} `pattern`
5037
- * @param {Object} `options`
5038
- * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
5039
- * @api public
5040
- */
5041
- picomatch$2.parse = (pattern, options) => {
5042
- if (Array.isArray(pattern)) return pattern.map((p$1) => picomatch$2.parse(p$1, options));
5043
- return parse(pattern, {
5044
- ...options,
5045
- fastpaths: false
5046
- });
5047
- };
5048
- /**
5049
- * Scan a glob pattern to separate the pattern into segments.
5050
- *
5051
- * ```js
5052
- * const picomatch = require('picomatch');
5053
- * // picomatch.scan(input[, options]);
5054
- *
5055
- * const result = picomatch.scan('!./foo/*.js');
5056
- * console.log(result);
5057
- * { prefix: '!./',
5058
- * input: '!./foo/*.js',
5059
- * start: 3,
5060
- * base: 'foo',
5061
- * glob: '*.js',
5062
- * isBrace: false,
5063
- * isBracket: false,
5064
- * isGlob: true,
5065
- * isExtglob: false,
5066
- * isGlobstar: false,
5067
- * negated: true }
5068
- * ```
5069
- * @param {String} `input` Glob pattern to scan.
5070
- * @param {Object} `options`
5071
- * @return {Object} Returns an object with
5072
- * @api public
5073
- */
5074
- picomatch$2.scan = (input, options) => scan(input, options);
5075
- /**
5076
- * Compile a regular expression from the `state` object returned by the
5077
- * [parse()](#parse) method.
5078
- *
5079
- * @param {Object} `state`
5080
- * @param {Object} `options`
5081
- * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
5082
- * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
5083
- * @return {RegExp}
5084
- * @api public
5085
- */
5086
- picomatch$2.compileRe = (state, options, returnOutput = false, returnState = false) => {
5087
- if (returnOutput === true) return state.output;
5088
- const opts = options || {};
5089
- const prepend = opts.contains ? "" : "^";
5090
- const append = opts.contains ? "" : "$";
5091
- let source = `${prepend}(?:${state.output})${append}`;
5092
- if (state && state.negated === true) source = `^(?!${source}).*$`;
5093
- const regex$2 = picomatch$2.toRegex(source, options);
5094
- if (returnState === true) regex$2.state = state;
5095
- return regex$2;
5096
- };
5097
- /**
5098
- * Create a regular expression from a parsed glob pattern.
5099
- *
5100
- * ```js
5101
- * const picomatch = require('picomatch');
5102
- * const state = picomatch.parse('*.js');
5103
- * // picomatch.compileRe(state[, options]);
5104
- *
5105
- * console.log(picomatch.compileRe(state));
5106
- * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
5107
- * ```
5108
- * @param {String} `state` The object returned from the `.parse` method.
5109
- * @param {Object} `options`
5110
- * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
5111
- * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
5112
- * @return {RegExp} Returns a regex created from the given pattern.
5113
- * @api public
5114
- */
5115
- picomatch$2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
5116
- if (!input || typeof input !== "string") throw new TypeError("Expected a non-empty string");
5117
- let parsed = {
5118
- negated: false,
5119
- fastpaths: true
5120
- };
5121
- if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse.fastpaths(input, options);
5122
- if (!parsed.output) parsed = parse(input, options);
5123
- return picomatch$2.compileRe(parsed, options, returnOutput, returnState);
5124
- };
5125
- /**
5126
- * Create a regular expression from the given regex source string.
5127
- *
5128
- * ```js
5129
- * const picomatch = require('picomatch');
5130
- * // picomatch.toRegex(source[, options]);
5131
- *
5132
- * const { output } = picomatch.parse('*.js');
5133
- * console.log(picomatch.toRegex(output));
5134
- * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
5135
- * ```
5136
- * @param {String} `source` Regular expression source string.
5137
- * @param {Object} `options`
5138
- * @return {RegExp}
5139
- * @api public
5140
- */
5141
- picomatch$2.toRegex = (source, options) => {
5142
- try {
5143
- const opts = options || {};
5144
- return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
5145
- } catch (err) {
5146
- if (options && options.debug === true) throw err;
5147
- return /$^/;
5148
- }
5149
- };
5150
- /**
5151
- * Picomatch constants.
5152
- * @return {Object}
5153
- */
5154
- picomatch$2.constants = constants;
5155
- /**
5156
- * Expose "picomatch"
5157
- */
5158
- module.exports = picomatch$2;
5159
- } });
5160
-
5161
- //#endregion
5162
- //#region node_modules/picomatch/index.js
5163
- var require_picomatch = __commonJS({ "node_modules/picomatch/index.js"(exports, module) {
5164
- const pico = require_picomatch$1();
5165
- const utils = require_utils();
5166
- function picomatch$1(glob$1, options, returnState = false) {
5167
- if (options && (options.windows === null || options.windows === void 0)) options = {
5168
- ...options,
5169
- windows: utils.isWindows()
5170
- };
5171
- return pico(glob$1, options, returnState);
5172
- }
5173
- Object.assign(picomatch$1, pico);
5174
- module.exports = picomatch$1;
5175
- } });
5176
-
5177
- //#endregion
5178
- //#region node_modules/fdir/dist/builder/index.js
5179
- var require_builder = __commonJS({ "node_modules/fdir/dist/builder/index.js"(exports) {
5180
- Object.defineProperty(exports, "__esModule", { value: true });
5181
- exports.Builder = void 0;
5182
- const path_1 = __require("path");
5183
- const api_builder_1 = require_api_builder();
5184
- var pm = null;
5185
- /* c8 ignore next 6 */
5186
- try {
5187
- __require.resolve("picomatch");
5188
- pm = require_picomatch();
5189
- } catch (_e) {}
5190
- var Builder = class {
5191
- globCache = {};
5192
- options = {
5193
- maxDepth: Infinity,
5194
- suppressErrors: true,
5195
- pathSeparator: path_1.sep,
5196
- filters: []
5197
- };
5198
- globFunction;
5199
- constructor(options) {
5200
- this.options = {
5201
- ...this.options,
5202
- ...options
5203
- };
5204
- this.globFunction = this.options.globFunction;
5205
- }
5206
- group() {
5207
- this.options.group = true;
5208
- return this;
5209
- }
5210
- withPathSeparator(separator) {
5211
- this.options.pathSeparator = separator;
5212
- return this;
5213
- }
5214
- withBasePath() {
5215
- this.options.includeBasePath = true;
5216
- return this;
5217
- }
5218
- withRelativePaths() {
5219
- this.options.relativePaths = true;
5220
- return this;
5221
- }
5222
- withDirs() {
5223
- this.options.includeDirs = true;
5224
- return this;
5225
- }
5226
- withMaxDepth(depth$1) {
5227
- this.options.maxDepth = depth$1;
5228
- return this;
5229
- }
5230
- withMaxFiles(limit) {
5231
- this.options.maxFiles = limit;
5232
- return this;
5233
- }
5234
- withFullPaths() {
5235
- this.options.resolvePaths = true;
5236
- this.options.includeBasePath = true;
5237
- return this;
5238
- }
5239
- withErrors() {
5240
- this.options.suppressErrors = false;
5241
- return this;
5242
- }
5243
- withSymlinks({ resolvePaths = true } = {}) {
5244
- this.options.resolveSymlinks = true;
5245
- this.options.useRealPaths = resolvePaths;
5246
- return this.withFullPaths();
5247
- }
5248
- withAbortSignal(signal) {
5249
- this.options.signal = signal;
5250
- return this;
5251
- }
5252
- normalize() {
5253
- this.options.normalizePath = true;
5254
- return this;
5255
- }
5256
- filter(predicate) {
5257
- this.options.filters.push(predicate);
5258
- return this;
5259
- }
5260
- onlyDirs() {
5261
- this.options.excludeFiles = true;
5262
- this.options.includeDirs = true;
5263
- return this;
5264
- }
5265
- exclude(predicate) {
5266
- this.options.exclude = predicate;
5267
- return this;
5268
- }
5269
- onlyCounts() {
5270
- this.options.onlyCounts = true;
5271
- return this;
5272
- }
5273
- crawl(root) {
5274
- return new api_builder_1.APIBuilder(root || ".", this.options);
5275
- }
5276
- withGlobFunction(fn) {
5277
- this.globFunction = fn;
5278
- return this;
5279
- }
5280
- /**
5281
- * @deprecated Pass options using the constructor instead:
5282
- * ```ts
5283
- * new fdir(options).crawl("/path/to/root");
5284
- * ```
5285
- * This method will be removed in v7.0
5286
- */
5287
- /* c8 ignore next 4 */
5288
- crawlWithOptions(root, options) {
5289
- this.options = {
5290
- ...this.options,
5291
- ...options
5292
- };
5293
- return new api_builder_1.APIBuilder(root || ".", this.options);
5294
- }
5295
- glob(...patterns) {
5296
- if (this.globFunction) return this.globWithOptions(patterns);
5297
- return this.globWithOptions(patterns, ...[{ dot: true }]);
5298
- }
5299
- globWithOptions(patterns, ...options) {
5300
- const globFn = this.globFunction || pm;
5301
- /* c8 ignore next 5 */
5302
- if (!globFn) throw new Error("Please specify a glob function to use glob matching.");
5303
- var isMatch = this.globCache[patterns.join("\0")];
5304
- if (!isMatch) {
5305
- isMatch = globFn(patterns, ...options);
5306
- this.globCache[patterns.join("\0")] = isMatch;
5307
- }
5308
- this.options.filters.push((path$2) => isMatch(path$2));
5309
- return this;
5310
- }
5311
- };
5312
- exports.Builder = Builder;
5313
- } });
5314
-
5315
- //#endregion
5316
- //#region node_modules/fdir/dist/types.js
5317
- var require_types = __commonJS({ "node_modules/fdir/dist/types.js"(exports) {
5318
- Object.defineProperty(exports, "__esModule", { value: true });
5319
- } });
5320
-
5321
- //#endregion
5322
- //#region node_modules/fdir/dist/index.js
5323
- var require_dist = __commonJS({ "node_modules/fdir/dist/index.js"(exports) {
5324
- var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function(o$1, m, k, k2) {
5325
- if (k2 === void 0) k2 = k;
5326
- var desc = Object.getOwnPropertyDescriptor(m, k);
5327
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
5328
- enumerable: true,
5329
- get: function() {
5330
- return m[k];
5331
- }
5332
- };
5333
- Object.defineProperty(o$1, k2, desc);
5334
- } : function(o$1, m, k, k2) {
5335
- if (k2 === void 0) k2 = k;
5336
- o$1[k2] = m[k];
5337
- });
5338
- var __exportStar = void 0 && (void 0).__exportStar || function(m, exports$1) {
5339
- for (var p$1 in m) if (p$1 !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p$1)) __createBinding(exports$1, m, p$1);
5340
- };
5341
- Object.defineProperty(exports, "__esModule", { value: true });
5342
- exports.fdir = void 0;
5343
- const builder_1 = require_builder();
5344
- Object.defineProperty(exports, "fdir", {
5345
- enumerable: true,
5346
- get: function() {
5347
- return builder_1.Builder;
5348
- }
5349
- });
5350
- __exportStar(require_types(), exports);
5351
- } });
5352
-
5353
- //#endregion
5354
- //#region node_modules/tinyglobby/dist/index.mjs
5355
- var import_dist = __toESM(require_dist(), 1);
5356
- var import_picomatch = __toESM(require_picomatch(), 1);
5357
- const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
5358
- function getPartialMatcher(patterns, options) {
5359
- const patternsCount = patterns.length;
5360
- const patternsParts = Array(patternsCount);
5361
- const regexes = Array(patternsCount);
5362
- for (let i$1 = 0; i$1 < patternsCount; i$1++) {
5363
- const parts = splitPattern(patterns[i$1]);
5364
- patternsParts[i$1] = parts;
5365
- const partsCount = parts.length;
5366
- const partRegexes = Array(partsCount);
5367
- for (let j = 0; j < partsCount; j++) partRegexes[j] = import_picomatch.default.makeRe(parts[j], options);
5368
- regexes[i$1] = partRegexes;
5369
- }
5370
- return (input) => {
5371
- const inputParts = input.split("/");
5372
- if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
5373
- for (let i$1 = 0; i$1 < patterns.length; i$1++) {
5374
- const patternParts = patternsParts[i$1];
5375
- const regex$2 = regexes[i$1];
5376
- const inputPatternCount = inputParts.length;
5377
- const minParts = Math.min(inputPatternCount, patternParts.length);
5378
- let j = 0;
5379
- while (j < minParts) {
5380
- const part = patternParts[j];
5381
- if (part.includes("/")) return true;
5382
- const match = regex$2[j].test(inputParts[j]);
5383
- if (!match) break;
5384
- if (part === "**") return true;
5385
- j++;
5386
- }
5387
- if (j === inputPatternCount) return true;
5388
- }
5389
- return false;
5390
- };
5391
- }
5392
- const splitPatternOptions = { parts: true };
5393
- function splitPattern(path$1$1) {
5394
- var _result$parts;
5395
- const result = import_picomatch.default.scan(path$1$1, splitPatternOptions);
5396
- return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1$1];
5397
- }
5398
- const isWin = process.platform === "win32";
5399
- const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
5400
- const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
5401
- const escapePosixPath = (path$1$1) => path$1$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
5402
- const escapeWin32Path = (path$1$1) => path$1$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
5403
- const escapePath = isWin ? escapeWin32Path : escapePosixPath;
5404
- function isDynamicPattern(pattern, options) {
5405
- if ((options === null || options === void 0 ? void 0 : options.caseSensitiveMatch) === false) return true;
5406
- const scan$2 = import_picomatch.default.scan(pattern);
5407
- return scan$2.isGlob || scan$2.negated;
5408
- }
5409
- function log$1(...tasks) {
5410
- console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`, ...tasks);
5411
- }
5412
- const PARENT_DIRECTORY = /^(\/?\.\.)+/;
5413
- const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
5414
- const BACKSLASHES = /\\/g;
5415
- function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
5416
- let result = pattern;
5417
- if (pattern.endsWith("/")) result = pattern.slice(0, -1);
5418
- if (!result.endsWith("*") && expandDirectories) result += "/**";
5419
- const escapedCwd = escapePath(cwd);
5420
- if (path$1.isAbsolute(result.replace(ESCAPING_BACKSLASHES, ""))) result = posix.relative(escapedCwd, result);
5421
- else result = posix.normalize(result);
5422
- const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
5423
- const parts = splitPattern(result);
5424
- if (parentDirectoryMatch === null || parentDirectoryMatch === void 0 ? void 0 : parentDirectoryMatch[0]) {
5425
- const n$1 = (parentDirectoryMatch[0].length + 1) / 3;
5426
- let i$1 = 0;
5427
- const cwdParts = escapedCwd.split("/");
5428
- while (i$1 < n$1 && parts[i$1 + n$1] === cwdParts[cwdParts.length + i$1 - n$1]) {
5429
- result = result.slice(0, (n$1 - i$1 - 1) * 3) + result.slice((n$1 - i$1) * 3 + parts[i$1 + n$1].length + 1) || ".";
5430
- i$1++;
5431
- }
5432
- const potentialRoot = posix.join(cwd, parentDirectoryMatch[0].slice(i$1 * 3));
5433
- if (!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length) {
5434
- props.root = potentialRoot;
5435
- props.depthOffset = -n$1 + i$1;
5436
- }
5437
- }
5438
- if (!isIgnore && props.depthOffset >= 0) {
5439
- var _props$commonPath;
5440
- (_props$commonPath = props.commonPath) !== null && _props$commonPath !== void 0 || (props.commonPath = parts);
5441
- const newCommonPath = [];
5442
- const length = Math.min(props.commonPath.length, parts.length);
5443
- for (let i$1 = 0; i$1 < length; i$1++) {
5444
- const part = parts[i$1];
5445
- if (part === "**" && !parts[i$1 + 1]) {
5446
- newCommonPath.pop();
5447
- break;
5448
- }
5449
- if (part !== props.commonPath[i$1] || isDynamicPattern(part) || i$1 === parts.length - 1) break;
5450
- newCommonPath.push(part);
5451
- }
5452
- props.depthOffset = newCommonPath.length;
5453
- props.commonPath = newCommonPath;
5454
- props.root = newCommonPath.length > 0 ? path$1.posix.join(cwd, ...newCommonPath) : cwd;
5455
- }
5456
- return result;
5457
- }
5458
- function processPatterns({ patterns, ignore = [], expandDirectories = true }, cwd, props) {
5459
- if (typeof patterns === "string") patterns = [patterns];
5460
- else if (!patterns) patterns = ["**/*"];
5461
- if (typeof ignore === "string") ignore = [ignore];
5462
- const matchPatterns = [];
5463
- const ignorePatterns = [];
5464
- for (const pattern of ignore) {
5465
- if (!pattern) continue;
5466
- if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, true));
5467
- }
5468
- for (const pattern of patterns) {
5469
- if (!pattern) continue;
5470
- if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, false));
5471
- else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), expandDirectories, cwd, props, true));
5472
- }
5473
- return {
5474
- match: matchPatterns,
5475
- ignore: ignorePatterns
5476
- };
5477
- }
5478
- function getRelativePath(path$1$1, cwd, root) {
5479
- return posix.relative(cwd, `${root}/${path$1$1}`) || ".";
5480
- }
5481
- function processPath(path$1$1, cwd, root, isDirectory, absolute) {
5482
- const relativePath = absolute ? path$1$1.slice(root === "/" ? 1 : root.length + 1) || "." : path$1$1;
5483
- if (root === cwd) return isDirectory && relativePath !== "." ? relativePath.slice(0, -1) : relativePath;
5484
- return getRelativePath(relativePath, cwd, root);
5485
- }
5486
- function formatPaths(paths, cwd, root) {
5487
- for (let i$1 = paths.length - 1; i$1 >= 0; i$1--) {
5488
- const path$1$1 = paths[i$1];
5489
- paths[i$1] = getRelativePath(path$1$1, cwd, root) + (!path$1$1 || path$1$1.endsWith("/") ? "/" : "");
5490
- }
5491
- return paths;
5492
- }
5493
- function crawl(options, cwd, sync$1) {
5494
- if (process.env.TINYGLOBBY_DEBUG) options.debug = true;
5495
- if (options.debug) log$1("globbing with options:", options, "cwd:", cwd);
5496
- if (Array.isArray(options.patterns) && options.patterns.length === 0) return sync$1 ? [] : Promise.resolve([]);
5497
- const props = {
5498
- root: cwd,
5499
- commonPath: null,
5500
- depthOffset: 0
5501
- };
5502
- const processed = processPatterns(options, cwd, props);
5503
- const nocase = options.caseSensitiveMatch === false;
5504
- if (options.debug) log$1("internal processing patterns:", processed);
5505
- const matcher = (0, import_picomatch.default)(processed.match, {
5506
- dot: options.dot,
5507
- nocase,
5508
- ignore: processed.ignore
5509
- });
5510
- const ignore = (0, import_picomatch.default)(processed.ignore, {
5511
- dot: options.dot,
5512
- nocase
5513
- });
5514
- const partialMatcher = getPartialMatcher(processed.match, {
5515
- dot: options.dot,
5516
- nocase
5517
- });
5518
- const fdirOptions = {
5519
- filters: [options.debug ? (p$1, isDirectory) => {
5520
- const path$1$1 = processPath(p$1, cwd, props.root, isDirectory, options.absolute);
5521
- const matches = matcher(path$1$1);
5522
- if (matches) log$1(`matched ${path$1$1}`);
5523
- return matches;
5524
- } : (p$1, isDirectory) => matcher(processPath(p$1, cwd, props.root, isDirectory, options.absolute))],
5525
- exclude: options.debug ? (_$1, p$1) => {
5526
- const relativePath = processPath(p$1, cwd, props.root, true, true);
5527
- const skipped = relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
5528
- if (skipped) log$1(`skipped ${p$1}`);
5529
- else log$1(`crawling ${p$1}`);
5530
- return skipped;
5531
- } : (_$1, p$1) => {
5532
- const relativePath = processPath(p$1, cwd, props.root, true, true);
5533
- return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
5534
- },
5535
- pathSeparator: "/",
5536
- relativePaths: true,
5537
- resolveSymlinks: true
5538
- };
5539
- if (options.deep !== void 0) fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
5540
- if (options.absolute) {
5541
- fdirOptions.relativePaths = false;
5542
- fdirOptions.resolvePaths = true;
5543
- fdirOptions.includeBasePath = true;
5544
- }
5545
- if (options.followSymbolicLinks === false) {
5546
- fdirOptions.resolveSymlinks = false;
5547
- fdirOptions.excludeSymlinks = true;
5548
- }
5549
- if (options.onlyDirectories) {
5550
- fdirOptions.excludeFiles = true;
5551
- fdirOptions.includeDirs = true;
5552
- } else if (options.onlyFiles === false) fdirOptions.includeDirs = true;
5553
- props.root = props.root.replace(BACKSLASHES, "");
5554
- const root = props.root;
5555
- if (options.debug) log$1("internal properties:", props);
5556
- const api = new import_dist.fdir(fdirOptions).crawl(root);
5557
- if (cwd === root || options.absolute) return sync$1 ? api.sync() : api.withPromise();
5558
- return sync$1 ? formatPaths(api.sync(), cwd, root) : api.withPromise().then((paths) => formatPaths(paths, cwd, root));
5559
- }
5560
- async function glob(patternsOrOptions, options) {
5561
- if (patternsOrOptions && (options === null || options === void 0 ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
5562
- const opts = Array.isArray(patternsOrOptions) || typeof patternsOrOptions === "string" ? {
5563
- ...options,
5564
- patterns: patternsOrOptions
5565
- } : patternsOrOptions;
5566
- const cwd = opts.cwd ? path$1.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
5567
- return crawl(opts, cwd, false);
5568
- }
5569
-
5570
- //#endregion
5571
- //#region node_modules/valibot/dist/index.js
5572
- var store;
5573
- /* @__NO_SIDE_EFFECTS__ */
5574
- function getGlobalConfig(config2) {
5575
- return {
5576
- lang: config2?.lang ?? store?.lang,
5577
- message: config2?.message,
5578
- abortEarly: config2?.abortEarly ?? store?.abortEarly,
5579
- abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
5580
- };
5581
- }
5582
- var store2;
5583
- /* @__NO_SIDE_EFFECTS__ */
5584
- function getGlobalMessage(lang) {
5585
- return store2?.get(lang);
5586
- }
5587
- var store3;
5588
- /* @__NO_SIDE_EFFECTS__ */
5589
- function getSchemaMessage(lang) {
5590
- return store3?.get(lang);
5591
- }
5592
- var store4;
5593
- /* @__NO_SIDE_EFFECTS__ */
5594
- function getSpecificMessage(reference, lang) {
5595
- return store4?.get(reference)?.get(lang);
5596
- }
5597
- /* @__NO_SIDE_EFFECTS__ */
5598
- function _stringify(input) {
5599
- const type = typeof input;
5600
- if (type === "string") return `"${input}"`;
5601
- if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
5602
- if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
5603
- return type;
5604
- }
5605
- function _addIssue(context, label, dataset, config2, other) {
5606
- const input = other && "input" in other ? other.input : dataset.value;
5607
- const expected = other?.expected ?? context.expects ?? null;
5608
- const received = other?.received ?? /* @__PURE__ */ _stringify(input);
5609
- const issue = {
5610
- kind: context.kind,
5611
- type: context.type,
5612
- input,
5613
- expected,
5614
- received,
5615
- message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
5616
- requirement: context.requirement,
5617
- path: other?.path,
5618
- issues: other?.issues,
5619
- lang: config2.lang,
5620
- abortEarly: config2.abortEarly,
5621
- abortPipeEarly: config2.abortPipeEarly
5622
- };
5623
- const isSchema = context.kind === "schema";
5624
- const message2 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
5625
- if (message2 !== void 0) issue.message = typeof message2 === "function" ? message2(issue) : message2;
5626
- if (isSchema) dataset.typed = false;
5627
- if (dataset.issues) dataset.issues.push(issue);
5628
- else dataset.issues = [issue];
5629
- }
5630
- /* @__NO_SIDE_EFFECTS__ */
5631
- function _getStandardProps(context) {
5632
- return {
5633
- version: 1,
5634
- vendor: "valibot",
5635
- validate(value2) {
5636
- return context["~run"]({ value: value2 }, /* @__PURE__ */ getGlobalConfig());
5637
- }
5638
- };
5639
- }
5640
- /* @__NO_SIDE_EFFECTS__ */
5641
- function _isValidObjectKey(object2, key) {
5642
- return Object.hasOwn(object2, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
5643
- }
5644
- /* @__NO_SIDE_EFFECTS__ */
5645
- function _joinExpects(values2, separator) {
5646
- const list = [...new Set(values2)];
5647
- if (list.length > 1) return `(${list.join(` ${separator} `)})`;
5648
- return list[0] ?? "never";
5649
- }
5650
- /* @__NO_SIDE_EFFECTS__ */
5651
- function regex$1(requirement, message2) {
5652
- return {
5653
- kind: "validation",
5654
- type: "regex",
5655
- reference: regex$1,
5656
- async: false,
5657
- expects: `${requirement}`,
5658
- requirement,
5659
- message: message2,
5660
- "~run"(dataset, config2) {
5661
- if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "format", dataset, config2);
5662
- return dataset;
5663
- }
5664
- };
5665
- }
5666
- /* @__NO_SIDE_EFFECTS__ */
5667
- function getFallback(schema, dataset, config2) {
5668
- return typeof schema.fallback === "function" ? schema.fallback(dataset, config2) : schema.fallback;
5669
- }
5670
- /* @__NO_SIDE_EFFECTS__ */
5671
- function getDefault(schema, dataset, config2) {
5672
- return typeof schema.default === "function" ? schema.default(dataset, config2) : schema.default;
5673
- }
5674
- /* @__NO_SIDE_EFFECTS__ */
5675
- function boolean(message2) {
5676
- return {
5677
- kind: "schema",
5678
- type: "boolean",
5679
- reference: boolean,
5680
- expects: "boolean",
5681
- async: false,
5682
- message: message2,
5683
- get "~standard"() {
5684
- return /* @__PURE__ */ _getStandardProps(this);
5685
- },
5686
- "~run"(dataset, config2) {
5687
- if (typeof dataset.value === "boolean") dataset.typed = true;
5688
- else _addIssue(this, "type", dataset, config2);
5689
- return dataset;
5690
- }
5691
- };
5692
- }
5693
- /* @__NO_SIDE_EFFECTS__ */
5694
- function number(message2) {
5695
- return {
5696
- kind: "schema",
5697
- type: "number",
5698
- reference: number,
5699
- expects: "number",
5700
- async: false,
5701
- message: message2,
5702
- get "~standard"() {
5703
- return /* @__PURE__ */ _getStandardProps(this);
5704
- },
5705
- "~run"(dataset, config2) {
5706
- if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
5707
- else _addIssue(this, "type", dataset, config2);
5708
- return dataset;
5709
- }
5710
- };
5711
- }
5712
- /* @__NO_SIDE_EFFECTS__ */
5713
- function object(entries2, message2) {
5714
- return {
5715
- kind: "schema",
5716
- type: "object",
5717
- reference: object,
5718
- expects: "Object",
5719
- async: false,
5720
- entries: entries2,
5721
- message: message2,
5722
- get "~standard"() {
5723
- return /* @__PURE__ */ _getStandardProps(this);
5724
- },
5725
- "~run"(dataset, config2) {
5726
- const input = dataset.value;
5727
- if (input && typeof input === "object") {
5728
- dataset.typed = true;
5729
- dataset.value = {};
5730
- for (const key in this.entries) {
5731
- const valueSchema = this.entries[key];
5732
- if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
5733
- const value2 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
5734
- const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
5735
- if (valueDataset.issues) {
5736
- const pathItem = {
5737
- type: "object",
5738
- origin: "value",
5739
- input,
5740
- key,
5741
- value: value2
5742
- };
5743
- for (const issue of valueDataset.issues) {
5744
- if (issue.path) issue.path.unshift(pathItem);
5745
- else issue.path = [pathItem];
5746
- dataset.issues?.push(issue);
5747
- }
5748
- if (!dataset.issues) dataset.issues = valueDataset.issues;
5749
- if (config2.abortEarly) {
5750
- dataset.typed = false;
5751
- break;
5752
- }
5753
- }
5754
- if (!valueDataset.typed) dataset.typed = false;
5755
- dataset.value[key] = valueDataset.value;
5756
- } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
5757
- else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
5758
- _addIssue(this, "key", dataset, config2, {
5759
- input: void 0,
5760
- expected: `"${key}"`,
5761
- path: [{
5762
- type: "object",
5763
- origin: "key",
5764
- input,
5765
- key,
5766
- value: input[key]
5767
- }]
5768
- });
5769
- if (config2.abortEarly) break;
5770
- }
5771
- }
5772
- } else _addIssue(this, "type", dataset, config2);
5773
- return dataset;
5774
- }
5775
- };
5776
- }
5777
- /* @__NO_SIDE_EFFECTS__ */
5778
- function optional(wrapped, default_) {
5779
- return {
5780
- kind: "schema",
5781
- type: "optional",
5782
- reference: optional,
5783
- expects: `(${wrapped.expects} | undefined)`,
5784
- async: false,
5785
- wrapped,
5786
- default: default_,
5787
- get "~standard"() {
5788
- return /* @__PURE__ */ _getStandardProps(this);
5789
- },
5790
- "~run"(dataset, config2) {
5791
- if (dataset.value === void 0) {
5792
- if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
5793
- if (dataset.value === void 0) {
5794
- dataset.typed = true;
5795
- return dataset;
5796
- }
5797
- }
5798
- return this.wrapped["~run"](dataset, config2);
5799
- }
5800
- };
5801
- }
5802
- /* @__NO_SIDE_EFFECTS__ */
5803
- function record(key, value2, message2) {
5804
- return {
5805
- kind: "schema",
5806
- type: "record",
5807
- reference: record,
5808
- expects: "Object",
5809
- async: false,
5810
- key,
5811
- value: value2,
5812
- message: message2,
5813
- get "~standard"() {
5814
- return /* @__PURE__ */ _getStandardProps(this);
5815
- },
5816
- "~run"(dataset, config2) {
5817
- const input = dataset.value;
5818
- if (input && typeof input === "object") {
5819
- dataset.typed = true;
5820
- dataset.value = {};
5821
- for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
5822
- const entryValue = input[entryKey];
5823
- const keyDataset = this.key["~run"]({ value: entryKey }, config2);
5824
- if (keyDataset.issues) {
5825
- const pathItem = {
5826
- type: "object",
5827
- origin: "key",
5828
- input,
5829
- key: entryKey,
5830
- value: entryValue
5831
- };
5832
- for (const issue of keyDataset.issues) {
5833
- issue.path = [pathItem];
5834
- dataset.issues?.push(issue);
5835
- }
5836
- if (!dataset.issues) dataset.issues = keyDataset.issues;
5837
- if (config2.abortEarly) {
5838
- dataset.typed = false;
5839
- break;
5840
- }
5841
- }
5842
- const valueDataset = this.value["~run"]({ value: entryValue }, config2);
5843
- if (valueDataset.issues) {
5844
- const pathItem = {
5845
- type: "object",
5846
- origin: "value",
5847
- input,
5848
- key: entryKey,
5849
- value: entryValue
5850
- };
5851
- for (const issue of valueDataset.issues) {
5852
- if (issue.path) issue.path.unshift(pathItem);
5853
- else issue.path = [pathItem];
5854
- dataset.issues?.push(issue);
5855
- }
5856
- if (!dataset.issues) dataset.issues = valueDataset.issues;
5857
- if (config2.abortEarly) {
5858
- dataset.typed = false;
5859
- break;
5860
- }
5861
- }
5862
- if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
5863
- if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
5864
- }
5865
- } else _addIssue(this, "type", dataset, config2);
5866
- return dataset;
5867
- }
5868
- };
5869
- }
5870
- /* @__NO_SIDE_EFFECTS__ */
5871
- function string(message2) {
5872
- return {
5873
- kind: "schema",
5874
- type: "string",
5875
- reference: string,
5876
- expects: "string",
5877
- async: false,
5878
- message: message2,
5879
- get "~standard"() {
5880
- return /* @__PURE__ */ _getStandardProps(this);
5881
- },
5882
- "~run"(dataset, config2) {
5883
- if (typeof dataset.value === "string") dataset.typed = true;
5884
- else _addIssue(this, "type", dataset, config2);
5885
- return dataset;
5886
- }
5887
- };
5888
- }
5889
- /* @__NO_SIDE_EFFECTS__ */
5890
- function _subIssues(datasets) {
5891
- let issues;
5892
- if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
5893
- else issues = dataset.issues;
5894
- return issues;
5895
- }
5896
- /* @__NO_SIDE_EFFECTS__ */
5897
- function union(options, message2) {
5898
- return {
5899
- kind: "schema",
5900
- type: "union",
5901
- reference: union,
5902
- expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
5903
- async: false,
5904
- options,
5905
- message: message2,
5906
- get "~standard"() {
5907
- return /* @__PURE__ */ _getStandardProps(this);
5908
- },
5909
- "~run"(dataset, config2) {
5910
- let validDataset;
5911
- let typedDatasets;
5912
- let untypedDatasets;
5913
- for (const schema of this.options) {
5914
- const optionDataset = schema["~run"]({ value: dataset.value }, config2);
5915
- if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
5916
- else typedDatasets = [optionDataset];
5917
- else {
5918
- validDataset = optionDataset;
5919
- break;
5920
- }
5921
- else if (untypedDatasets) untypedDatasets.push(optionDataset);
5922
- else untypedDatasets = [optionDataset];
5923
- }
5924
- if (validDataset) return validDataset;
5925
- if (typedDatasets) {
5926
- if (typedDatasets.length === 1) return typedDatasets[0];
5927
- _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
5928
- dataset.typed = true;
5929
- } else if (untypedDatasets?.length === 1) return untypedDatasets[0];
5930
- else _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
5931
- return dataset;
5932
- }
5933
- };
5934
- }
5935
- /* @__NO_SIDE_EFFECTS__ */
5936
- function pipe(...pipe2) {
5937
- return {
5938
- ...pipe2[0],
5939
- pipe: pipe2,
5940
- get "~standard"() {
5941
- return /* @__PURE__ */ _getStandardProps(this);
5942
- },
5943
- "~run"(dataset, config2) {
5944
- for (const item of pipe2) if (item.kind !== "metadata") {
5945
- if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
5946
- dataset.typed = false;
5947
- break;
5948
- }
5949
- if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) dataset = item["~run"](dataset, config2);
5950
- }
5951
- return dataset;
5952
- }
5953
- };
5954
- }
5955
- /* @__NO_SIDE_EFFECTS__ */
5956
- function safeParse(schema, input, config2) {
5957
- const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
5958
- return {
5959
- typed: dataset.typed,
5960
- success: !dataset.issues,
5961
- output: dataset.value,
5962
- issues: dataset.issues
5963
- };
5964
- }
5965
-
5966
- //#endregion
5967
- //#region data-loader.ts
5968
- const getDefaultClaudePath = () => path.join(homedir(), ".claude");
5969
- const UsageDataSchema = object({
5970
- timestamp: string(),
5971
- message: object({ usage: object({
5972
- input_tokens: number(),
5973
- output_tokens: number(),
5974
- cache_creation_input_tokens: optional(number()),
5975
- cache_read_input_tokens: optional(number())
5976
- }) }),
5977
- costUSD: number()
5978
- });
5979
- const DailyUsageSchema = object({
5980
- date: string(),
5981
- inputTokens: number(),
5982
- outputTokens: number(),
5983
- cacheCreationTokens: number(),
5984
- cacheReadTokens: number(),
5985
- totalCost: number()
5986
- });
5987
- const SessionUsageSchema = object({
5988
- sessionId: string(),
5989
- projectPath: string(),
5990
- inputTokens: number(),
5991
- outputTokens: number(),
5992
- cacheCreationTokens: number(),
5993
- cacheReadTokens: number(),
5994
- totalCost: number(),
5995
- lastActivity: string()
5996
- });
5997
- const formatDate = (dateStr) => {
5998
- const date = new Date(dateStr);
5999
- const year = date.getFullYear();
6000
- const month = String(date.getMonth() + 1).padStart(2, "0");
6001
- const day = String(date.getDate()).padStart(2, "0");
6002
- return `${year}-${month}-${day}`;
6003
- };
6004
- async function loadUsageData(options) {
6005
- const claudePath = options?.claudePath ?? getDefaultClaudePath();
6006
- const claudeDir = path.join(claudePath, "projects");
6007
- const files = await glob(["**/*.jsonl"], {
6008
- cwd: claudeDir,
6009
- absolute: true
6010
- });
6011
- if (files.length === 0) return [];
6012
- const dailyMap = new Map();
6013
- for (const file of files) {
6014
- const content = await readFile(file, "utf-8");
6015
- const lines = content.trim().split("\n").filter((line) => line.length > 0);
6016
- for (const line of lines) try {
6017
- const parsed = JSON.parse(line);
6018
- const result = safeParse(UsageDataSchema, parsed);
6019
- if (!result.success) continue;
6020
- const data = result.output;
6021
- const date = formatDate(data.timestamp);
6022
- const existing = dailyMap.get(date) || {
6023
- date,
6024
- inputTokens: 0,
6025
- outputTokens: 0,
6026
- cacheCreationTokens: 0,
6027
- cacheReadTokens: 0,
6028
- totalCost: 0
6029
- };
6030
- existing.inputTokens += data.message.usage.input_tokens || 0;
6031
- existing.outputTokens += data.message.usage.output_tokens || 0;
6032
- existing.cacheCreationTokens += data.message.usage.cache_creation_input_tokens || 0;
6033
- existing.cacheReadTokens += data.message.usage.cache_read_input_tokens || 0;
6034
- existing.totalCost += data.costUSD || 0;
6035
- dailyMap.set(date, existing);
6036
- } catch (e) {}
6037
- }
6038
- let results = Array.from(dailyMap.values());
6039
- if (options?.since || options?.until) results = results.filter((data) => {
6040
- const dateStr = data.date.replace(/-/g, "");
6041
- if (options.since && dateStr < options.since) return false;
6042
- if (options.until && dateStr > options.until) return false;
6043
- return true;
6044
- });
6045
- return results.sort((a$1, b$1) => {
6046
- const dateA = new Date(a$1.date);
6047
- const dateB = new Date(b$1.date);
6048
- return dateB.getTime() - dateA.getTime();
6049
- });
6050
- }
6051
- async function loadSessionData(options) {
6052
- const claudePath = options?.claudePath ?? getDefaultClaudePath();
6053
- const claudeDir = path.join(claudePath, "projects");
6054
- const files = await glob(["**/*.jsonl"], {
6055
- cwd: claudeDir,
6056
- absolute: true
6057
- });
6058
- if (files.length === 0) return [];
6059
- const sessionMap = new Map();
6060
- for (const file of files) {
6061
- const relativePath = path.relative(claudeDir, file);
6062
- const parts = relativePath.split(path.sep);
6063
- const sessionId = parts[parts.length - 2];
6064
- const projectPath = parts.slice(0, -2).join(path.sep);
6065
- const content = await readFile(file, "utf-8");
6066
- const lines = content.trim().split("\n").filter((line) => line.length > 0);
6067
- let lastTimestamp = "";
6068
- for (const line of lines) try {
6069
- const parsed = JSON.parse(line);
6070
- const result = safeParse(UsageDataSchema, parsed);
6071
- if (!result.success) continue;
6072
- const data = result.output;
6073
- const key = `${projectPath}/${sessionId}`;
6074
- const existing = sessionMap.get(key) || {
6075
- sessionId: sessionId || "unknown",
6076
- projectPath: projectPath || "Unknown Project",
6077
- inputTokens: 0,
6078
- outputTokens: 0,
6079
- cacheCreationTokens: 0,
6080
- cacheReadTokens: 0,
6081
- totalCost: 0,
6082
- lastActivity: ""
6083
- };
6084
- existing.inputTokens += data.message.usage.input_tokens || 0;
6085
- existing.outputTokens += data.message.usage.output_tokens || 0;
6086
- existing.cacheCreationTokens += data.message.usage.cache_creation_input_tokens || 0;
6087
- existing.cacheReadTokens += data.message.usage.cache_read_input_tokens || 0;
6088
- existing.totalCost += data.costUSD || 0;
6089
- if (data.timestamp > lastTimestamp) {
6090
- lastTimestamp = data.timestamp;
6091
- existing.lastActivity = formatDate(data.timestamp);
6092
- }
6093
- sessionMap.set(key, existing);
6094
- } catch (e) {}
6095
- }
6096
- let results = Array.from(sessionMap.values());
6097
- if (options?.since || options?.until) results = results.filter((session) => {
6098
- const dateStr = session.lastActivity.replace(/-/g, "");
6099
- if (options.since && dateStr < options.since) return false;
6100
- if (options.until && dateStr > options.until) return false;
6101
- return true;
6102
- });
6103
- return results.sort((a$1, b$1) => {
6104
- return b$1.totalCost - a$1.totalCost;
6105
- });
6106
- }
6107
-
6108
2875
  //#endregion
6109
2876
  //#region node_modules/consola/dist/core.mjs
6110
2877
  const LogLevels = {
@@ -6911,10 +3678,10 @@ function ansiRegex({ onlyFirst = false } = {}) {
6911
3678
  const pattern = [`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`, "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
6912
3679
  return new RegExp(pattern, onlyFirst ? void 0 : "g");
6913
3680
  }
6914
- const regex = ansiRegex();
3681
+ const regex$1 = ansiRegex();
6915
3682
  function stripAnsi(string$1) {
6916
3683
  if (typeof string$1 !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string$1}\``);
6917
- return string$1.replace(regex, "");
3684
+ return string$1.replace(regex$1, "");
6918
3685
  }
6919
3686
  function isAmbiguous(x) {
6920
3687
  return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
@@ -7052,7 +3819,7 @@ function createConsola(options = {}) {
7052
3819
  defaults: { level: level$1 },
7053
3820
  stdout: process.stdout,
7054
3821
  stderr: process.stderr,
7055
- prompt: (...args) => import("./prompt-CYpzkwkf.js").then((m) => m.prompt(...args)),
3822
+ prompt: (...args) => import("./prompt-_w55ddDU.js").then((m) => m.prompt(...args)),
7056
3823
  reporters: options.reporters || [options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
7057
3824
  ...options
7058
3825
  });
@@ -7068,7 +3835,7 @@ const consola = createConsola();
7068
3835
  //#endregion
7069
3836
  //#region package.json
7070
3837
  var name = "ccusage";
7071
- var version = "0.2.2";
3838
+ var version = "0.3.0";
7072
3839
  var description = "Usage analysis tool for Claude Code";
7073
3840
 
7074
3841
  //#endregion
@@ -7107,7 +3874,7 @@ const ModelSpecSchema = object({
7107
3874
  deprecation_date: optional(string())
7108
3875
  });
7109
3876
  const LiteLLMModelPricesSchema = record(string(), ModelSpecSchema);
7110
- const dateSchema = pipe(string(), regex$1(/^\d{8}$/, "Date must be in YYYYMMDD format"));
3877
+ const dateSchema = pipe(string(), regex(/^\d{8}$/, "Date must be in YYYYMMDD format"));
7111
3878
 
7112
3879
  //#endregion
7113
3880
  //#region shared-args.ts