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