@musistudio/claude-code-router 1.0.37 → 1.0.38
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 +9 -4
- package/README_zh.md +9 -4
- package/dist/cli.js +942 -414
- package/dist/index.html +119 -55
- package/package.json +2 -2
- package/config.example.json +0 -119
package/dist/cli.js
CHANGED
|
@@ -1138,11 +1138,11 @@ var require_lib = __commonJS({
|
|
|
1138
1138
|
"node_modules/.pnpm/json5@2.2.3/node_modules/json5/lib/index.js"(exports2, module2) {
|
|
1139
1139
|
var parse = require_parse();
|
|
1140
1140
|
var stringify = require_stringify();
|
|
1141
|
-
var
|
|
1141
|
+
var JSON53 = {
|
|
1142
1142
|
parse,
|
|
1143
1143
|
stringify
|
|
1144
1144
|
};
|
|
1145
|
-
module2.exports =
|
|
1145
|
+
module2.exports = JSON53;
|
|
1146
1146
|
}
|
|
1147
1147
|
});
|
|
1148
1148
|
|
|
@@ -4830,8 +4830,8 @@ var require_req = __commonJS({
|
|
|
4830
4830
|
if (req.originalUrl) {
|
|
4831
4831
|
_req.url = req.originalUrl;
|
|
4832
4832
|
} else {
|
|
4833
|
-
const
|
|
4834
|
-
_req.url = typeof
|
|
4833
|
+
const path7 = req.path;
|
|
4834
|
+
_req.url = typeof path7 === "string" ? path7 : req.url ? req.url.path || req.url : void 0;
|
|
4835
4835
|
}
|
|
4836
4836
|
if (req.query) {
|
|
4837
4837
|
_req.query = req.query;
|
|
@@ -5020,17 +5020,17 @@ var require_parse2 = __commonJS({
|
|
|
5020
5020
|
const wildcards = [];
|
|
5021
5021
|
var wcLen = 0;
|
|
5022
5022
|
const secret = paths.reduce(function(o, strPath, ix) {
|
|
5023
|
-
var
|
|
5023
|
+
var path7 = strPath.match(rx).map((p) => p.replace(/'|"|`/g, ""));
|
|
5024
5024
|
const leadingBracket = strPath[0] === "[";
|
|
5025
|
-
|
|
5025
|
+
path7 = path7.map((p) => {
|
|
5026
5026
|
if (p[0] === "[") return p.substr(1, p.length - 2);
|
|
5027
5027
|
else return p;
|
|
5028
5028
|
});
|
|
5029
|
-
const star =
|
|
5029
|
+
const star = path7.indexOf("*");
|
|
5030
5030
|
if (star > -1) {
|
|
5031
|
-
const before =
|
|
5031
|
+
const before = path7.slice(0, star);
|
|
5032
5032
|
const beforeStr = before.join(".");
|
|
5033
|
-
const after =
|
|
5033
|
+
const after = path7.slice(star + 1, path7.length);
|
|
5034
5034
|
const nested = after.length > 0;
|
|
5035
5035
|
wcLen++;
|
|
5036
5036
|
wildcards.push({
|
|
@@ -5041,7 +5041,7 @@ var require_parse2 = __commonJS({
|
|
|
5041
5041
|
});
|
|
5042
5042
|
} else {
|
|
5043
5043
|
o[strPath] = {
|
|
5044
|
-
path:
|
|
5044
|
+
path: path7,
|
|
5045
5045
|
val: void 0,
|
|
5046
5046
|
precensored: false,
|
|
5047
5047
|
circle: "",
|
|
@@ -5087,20 +5087,20 @@ var require_redactor = __commonJS({
|
|
|
5087
5087
|
return redact;
|
|
5088
5088
|
}
|
|
5089
5089
|
function redactTmpl(secret, isCensorFct, censorFctTakesPath) {
|
|
5090
|
-
return Object.keys(secret).map((
|
|
5091
|
-
const { escPath, leadingBracket, path: arrPath } = secret[
|
|
5090
|
+
return Object.keys(secret).map((path7) => {
|
|
5091
|
+
const { escPath, leadingBracket, path: arrPath } = secret[path7];
|
|
5092
5092
|
const skip = leadingBracket ? 1 : 0;
|
|
5093
5093
|
const delim = leadingBracket ? "" : ".";
|
|
5094
5094
|
const hops = [];
|
|
5095
5095
|
var match;
|
|
5096
|
-
while ((match = rx.exec(
|
|
5096
|
+
while ((match = rx.exec(path7)) !== null) {
|
|
5097
5097
|
const [, ix] = match;
|
|
5098
5098
|
const { index, input } = match;
|
|
5099
5099
|
if (index > skip) hops.push(input.substring(0, index - (ix ? 0 : 1)));
|
|
5100
5100
|
}
|
|
5101
5101
|
var existence = hops.map((p) => `o${delim}${p}`).join(" && ");
|
|
5102
|
-
if (existence.length === 0) existence += `o${delim}${
|
|
5103
|
-
else existence += ` && o${delim}${
|
|
5102
|
+
if (existence.length === 0) existence += `o${delim}${path7} != null`;
|
|
5103
|
+
else existence += ` && o${delim}${path7} != null`;
|
|
5104
5104
|
const circularDetection = `
|
|
5105
5105
|
switch (true) {
|
|
5106
5106
|
${hops.reverse().map((p) => `
|
|
@@ -5113,12 +5113,12 @@ var require_redactor = __commonJS({
|
|
|
5113
5113
|
const censorArgs = censorFctTakesPath ? `val, ${JSON.stringify(arrPath)}` : `val`;
|
|
5114
5114
|
return `
|
|
5115
5115
|
if (${existence}) {
|
|
5116
|
-
const val = o${delim}${
|
|
5116
|
+
const val = o${delim}${path7}
|
|
5117
5117
|
if (val === censor) {
|
|
5118
5118
|
secret[${escPath}].precensored = true
|
|
5119
5119
|
} else {
|
|
5120
5120
|
secret[${escPath}].val = val
|
|
5121
|
-
o${delim}${
|
|
5121
|
+
o${delim}${path7} = ${isCensorFct ? `censor(${censorArgs})` : "censor"}
|
|
5122
5122
|
${circularDetection}
|
|
5123
5123
|
}
|
|
5124
5124
|
}
|
|
@@ -5170,13 +5170,13 @@ var require_modifiers = __commonJS({
|
|
|
5170
5170
|
target[k] = values[i];
|
|
5171
5171
|
}
|
|
5172
5172
|
}
|
|
5173
|
-
function groupRedact(o,
|
|
5174
|
-
const target = get(o,
|
|
5173
|
+
function groupRedact(o, path7, censor, isCensorFct, censorFctTakesPath) {
|
|
5174
|
+
const target = get(o, path7);
|
|
5175
5175
|
if (target == null || typeof target === "string") return { keys: null, values: null, target, flat: true };
|
|
5176
5176
|
const keys = Object.keys(target);
|
|
5177
5177
|
const keysLength = keys.length;
|
|
5178
|
-
const pathLength =
|
|
5179
|
-
const pathWithKey = censorFctTakesPath ? [...
|
|
5178
|
+
const pathLength = path7.length;
|
|
5179
|
+
const pathWithKey = censorFctTakesPath ? [...path7] : void 0;
|
|
5180
5180
|
const values = new Array(keysLength);
|
|
5181
5181
|
for (var i = 0; i < keysLength; i++) {
|
|
5182
5182
|
const key = keys[i];
|
|
@@ -5194,29 +5194,29 @@ var require_modifiers = __commonJS({
|
|
|
5194
5194
|
}
|
|
5195
5195
|
function nestedRestore(instructions) {
|
|
5196
5196
|
for (let i = 0; i < instructions.length; i++) {
|
|
5197
|
-
const { target, path:
|
|
5197
|
+
const { target, path: path7, value } = instructions[i];
|
|
5198
5198
|
let current = target;
|
|
5199
|
-
for (let i2 =
|
|
5200
|
-
current = current[
|
|
5199
|
+
for (let i2 = path7.length - 1; i2 > 0; i2--) {
|
|
5200
|
+
current = current[path7[i2]];
|
|
5201
5201
|
}
|
|
5202
|
-
current[
|
|
5202
|
+
current[path7[0]] = value;
|
|
5203
5203
|
}
|
|
5204
5204
|
}
|
|
5205
|
-
function nestedRedact(store, o,
|
|
5206
|
-
const target = get(o,
|
|
5205
|
+
function nestedRedact(store, o, path7, ns, censor, isCensorFct, censorFctTakesPath) {
|
|
5206
|
+
const target = get(o, path7);
|
|
5207
5207
|
if (target == null) return;
|
|
5208
5208
|
const keys = Object.keys(target);
|
|
5209
5209
|
const keysLength = keys.length;
|
|
5210
5210
|
for (var i = 0; i < keysLength; i++) {
|
|
5211
5211
|
const key = keys[i];
|
|
5212
|
-
specialSet(store, target, key,
|
|
5212
|
+
specialSet(store, target, key, path7, ns, censor, isCensorFct, censorFctTakesPath);
|
|
5213
5213
|
}
|
|
5214
5214
|
return store;
|
|
5215
5215
|
}
|
|
5216
5216
|
function has(obj, prop) {
|
|
5217
5217
|
return obj !== void 0 && obj !== null ? "hasOwn" in Object ? Object.hasOwn(obj, prop) : Object.prototype.hasOwnProperty.call(obj, prop) : false;
|
|
5218
5218
|
}
|
|
5219
|
-
function specialSet(store, o, k,
|
|
5219
|
+
function specialSet(store, o, k, path7, afterPath, censor, isCensorFct, censorFctTakesPath) {
|
|
5220
5220
|
const afterPathLen = afterPath.length;
|
|
5221
5221
|
const lastPathIndex = afterPathLen - 1;
|
|
5222
5222
|
const originalKey = k;
|
|
@@ -5259,7 +5259,7 @@ var require_modifiers = __commonJS({
|
|
|
5259
5259
|
if (consecutive) {
|
|
5260
5260
|
redactPathCurrent = node(redactPathCurrent, wck, depth);
|
|
5261
5261
|
level = i;
|
|
5262
|
-
ov = iterateNthLevel(wcov, level - 1, k,
|
|
5262
|
+
ov = iterateNthLevel(wcov, level - 1, k, path7, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, redactPathCurrent, store, o[originalKey], depth + 1);
|
|
5263
5263
|
} else {
|
|
5264
5264
|
if (kIsWc || typeof wcov === "object" && wcov !== null && k in wcov) {
|
|
5265
5265
|
if (kIsWc) {
|
|
@@ -5267,7 +5267,7 @@ var require_modifiers = __commonJS({
|
|
|
5267
5267
|
} else {
|
|
5268
5268
|
ov = wcov[k];
|
|
5269
5269
|
}
|
|
5270
|
-
nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...
|
|
5270
|
+
nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...path7, originalKey, ...afterPath]) : censor(ov) : censor;
|
|
5271
5271
|
if (kIsWc) {
|
|
5272
5272
|
const rv = restoreInstr(node(redactPathCurrent, wck, depth), ov, o[originalKey]);
|
|
5273
5273
|
store.push(rv);
|
|
@@ -5290,7 +5290,7 @@ var require_modifiers = __commonJS({
|
|
|
5290
5290
|
} else {
|
|
5291
5291
|
ov = n[k];
|
|
5292
5292
|
redactPathCurrent = node(redactPathCurrent, k, depth);
|
|
5293
|
-
nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...
|
|
5293
|
+
nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...path7, originalKey, ...afterPath]) : censor(ov) : censor;
|
|
5294
5294
|
if (has(n, k) && nv === ov || nv === void 0 && censor !== void 0) {
|
|
5295
5295
|
} else {
|
|
5296
5296
|
const rv = restoreInstr(redactPathCurrent, ov, o[originalKey]);
|
|
@@ -5313,7 +5313,7 @@ var require_modifiers = __commonJS({
|
|
|
5313
5313
|
}
|
|
5314
5314
|
return n;
|
|
5315
5315
|
}
|
|
5316
|
-
function iterateNthLevel(wcov, level, k,
|
|
5316
|
+
function iterateNthLevel(wcov, level, k, path7, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, redactPathCurrent, store, parent, depth) {
|
|
5317
5317
|
if (level === 0) {
|
|
5318
5318
|
if (kIsWc || typeof wcov === "object" && wcov !== null && k in wcov) {
|
|
5319
5319
|
if (kIsWc) {
|
|
@@ -5321,7 +5321,7 @@ var require_modifiers = __commonJS({
|
|
|
5321
5321
|
} else {
|
|
5322
5322
|
ov = wcov[k];
|
|
5323
5323
|
}
|
|
5324
|
-
nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...
|
|
5324
|
+
nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...path7, originalKey, ...afterPath]) : censor(ov) : censor;
|
|
5325
5325
|
if (kIsWc) {
|
|
5326
5326
|
const rv = restoreInstr(redactPathCurrent, ov, parent);
|
|
5327
5327
|
store.push(rv);
|
|
@@ -5340,7 +5340,7 @@ var require_modifiers = __commonJS({
|
|
|
5340
5340
|
for (const key in wcov) {
|
|
5341
5341
|
if (typeof wcov[key] === "object") {
|
|
5342
5342
|
redactPathCurrent = node(redactPathCurrent, key, depth);
|
|
5343
|
-
iterateNthLevel(wcov[key], level - 1, k,
|
|
5343
|
+
iterateNthLevel(wcov[key], level - 1, k, path7, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, redactPathCurrent, store, parent, depth + 1);
|
|
5344
5344
|
}
|
|
5345
5345
|
}
|
|
5346
5346
|
}
|
|
@@ -5362,12 +5362,12 @@ var require_modifiers = __commonJS({
|
|
|
5362
5362
|
}
|
|
5363
5363
|
function restoreInstr(node2, value, target) {
|
|
5364
5364
|
let current = node2;
|
|
5365
|
-
const
|
|
5365
|
+
const path7 = [];
|
|
5366
5366
|
do {
|
|
5367
|
-
|
|
5367
|
+
path7.push(current.key);
|
|
5368
5368
|
current = current.parent;
|
|
5369
5369
|
} while (current.parent != null);
|
|
5370
|
-
return { path:
|
|
5370
|
+
return { path: path7, value, target };
|
|
5371
5371
|
}
|
|
5372
5372
|
}
|
|
5373
5373
|
});
|
|
@@ -5397,10 +5397,10 @@ var require_restorer = __commonJS({
|
|
|
5397
5397
|
};
|
|
5398
5398
|
}
|
|
5399
5399
|
function resetTmpl(secret, paths) {
|
|
5400
|
-
return paths.map((
|
|
5401
|
-
const { circle, escPath, leadingBracket } = secret[
|
|
5400
|
+
return paths.map((path7) => {
|
|
5401
|
+
const { circle, escPath, leadingBracket } = secret[path7];
|
|
5402
5402
|
const delim = leadingBracket ? "" : ".";
|
|
5403
|
-
const reset = circle ? `o.${circle} = secret[${escPath}].val` : `o${delim}${
|
|
5403
|
+
const reset = circle ? `o.${circle} = secret[${escPath}].val` : `o${delim}${path7} = secret[${escPath}].val`;
|
|
5404
5404
|
const clear = `secret[${escPath}].val = undefined`;
|
|
5405
5405
|
return `
|
|
5406
5406
|
if (secret[${escPath}].val !== undefined) {
|
|
@@ -5632,8 +5632,8 @@ var require_redaction = __commonJS({
|
|
|
5632
5632
|
if (shape[k] === null) {
|
|
5633
5633
|
o[k] = (value) => topCensor(value, [k]);
|
|
5634
5634
|
} else {
|
|
5635
|
-
const wrappedCensor = typeof censor === "function" ? (value,
|
|
5636
|
-
return censor(value, [k, ...
|
|
5635
|
+
const wrappedCensor = typeof censor === "function" ? (value, path7) => {
|
|
5636
|
+
return censor(value, [k, ...path7]);
|
|
5637
5637
|
} : censor;
|
|
5638
5638
|
o[k] = fastRedact({
|
|
5639
5639
|
paths: shape[k],
|
|
@@ -5833,10 +5833,10 @@ var require_atomic_sleep = __commonJS({
|
|
|
5833
5833
|
var require_sonic_boom = __commonJS({
|
|
5834
5834
|
"node_modules/.pnpm/sonic-boom@4.2.0/node_modules/sonic-boom/index.js"(exports2, module2) {
|
|
5835
5835
|
"use strict";
|
|
5836
|
-
var
|
|
5836
|
+
var fs7 = require("fs");
|
|
5837
5837
|
var EventEmitter = require("events");
|
|
5838
5838
|
var inherits = require("util").inherits;
|
|
5839
|
-
var
|
|
5839
|
+
var path7 = require("path");
|
|
5840
5840
|
var sleep = require_atomic_sleep();
|
|
5841
5841
|
var assert = require("assert");
|
|
5842
5842
|
var BUSY_WRITE_TIMEOUT = 100;
|
|
@@ -5890,20 +5890,20 @@ var require_sonic_boom = __commonJS({
|
|
|
5890
5890
|
const mode = sonic.mode;
|
|
5891
5891
|
if (sonic.sync) {
|
|
5892
5892
|
try {
|
|
5893
|
-
if (sonic.mkdir)
|
|
5894
|
-
const fd2 =
|
|
5893
|
+
if (sonic.mkdir) fs7.mkdirSync(path7.dirname(file), { recursive: true });
|
|
5894
|
+
const fd2 = fs7.openSync(file, flags, mode);
|
|
5895
5895
|
fileOpened(null, fd2);
|
|
5896
5896
|
} catch (err) {
|
|
5897
5897
|
fileOpened(err);
|
|
5898
5898
|
throw err;
|
|
5899
5899
|
}
|
|
5900
5900
|
} else if (sonic.mkdir) {
|
|
5901
|
-
|
|
5901
|
+
fs7.mkdir(path7.dirname(file), { recursive: true }, (err) => {
|
|
5902
5902
|
if (err) return fileOpened(err);
|
|
5903
|
-
|
|
5903
|
+
fs7.open(file, flags, mode, fileOpened);
|
|
5904
5904
|
});
|
|
5905
5905
|
} else {
|
|
5906
|
-
|
|
5906
|
+
fs7.open(file, flags, mode, fileOpened);
|
|
5907
5907
|
}
|
|
5908
5908
|
}
|
|
5909
5909
|
function SonicBoom(opts) {
|
|
@@ -5944,16 +5944,16 @@ var require_sonic_boom = __commonJS({
|
|
|
5944
5944
|
this.flush = flushBuffer;
|
|
5945
5945
|
this.flushSync = flushBufferSync;
|
|
5946
5946
|
this._actualWrite = actualWriteBuffer;
|
|
5947
|
-
fsWriteSync = () =>
|
|
5948
|
-
fsWrite = () =>
|
|
5947
|
+
fsWriteSync = () => fs7.writeSync(this.fd, this._writingBuf);
|
|
5948
|
+
fsWrite = () => fs7.write(this.fd, this._writingBuf, this.release);
|
|
5949
5949
|
} else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
|
|
5950
5950
|
this._writingBuf = "";
|
|
5951
5951
|
this.write = write;
|
|
5952
5952
|
this.flush = flush;
|
|
5953
5953
|
this.flushSync = flushSync;
|
|
5954
5954
|
this._actualWrite = actualWrite;
|
|
5955
|
-
fsWriteSync = () =>
|
|
5956
|
-
fsWrite = () =>
|
|
5955
|
+
fsWriteSync = () => fs7.writeSync(this.fd, this._writingBuf, "utf8");
|
|
5956
|
+
fsWrite = () => fs7.write(this.fd, this._writingBuf, "utf8", this.release);
|
|
5957
5957
|
} else {
|
|
5958
5958
|
throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
|
|
5959
5959
|
}
|
|
@@ -6009,7 +6009,7 @@ var require_sonic_boom = __commonJS({
|
|
|
6009
6009
|
}
|
|
6010
6010
|
}
|
|
6011
6011
|
if (this._fsync) {
|
|
6012
|
-
|
|
6012
|
+
fs7.fsyncSync(this.fd);
|
|
6013
6013
|
}
|
|
6014
6014
|
const len = this._len;
|
|
6015
6015
|
if (this._reopening) {
|
|
@@ -6121,7 +6121,7 @@ var require_sonic_boom = __commonJS({
|
|
|
6121
6121
|
const onDrain = () => {
|
|
6122
6122
|
if (!this._fsync) {
|
|
6123
6123
|
try {
|
|
6124
|
-
|
|
6124
|
+
fs7.fsync(this.fd, (err) => {
|
|
6125
6125
|
this._flushPending = false;
|
|
6126
6126
|
cb(err);
|
|
6127
6127
|
});
|
|
@@ -6223,7 +6223,7 @@ var require_sonic_boom = __commonJS({
|
|
|
6223
6223
|
const fd2 = this.fd;
|
|
6224
6224
|
this.once("ready", () => {
|
|
6225
6225
|
if (fd2 !== this.fd) {
|
|
6226
|
-
|
|
6226
|
+
fs7.close(fd2, (err) => {
|
|
6227
6227
|
if (err) {
|
|
6228
6228
|
return this.emit("error", err);
|
|
6229
6229
|
}
|
|
@@ -6272,7 +6272,7 @@ var require_sonic_boom = __commonJS({
|
|
|
6272
6272
|
buf = this._bufs[0];
|
|
6273
6273
|
}
|
|
6274
6274
|
try {
|
|
6275
|
-
const n =
|
|
6275
|
+
const n = fs7.writeSync(this.fd, buf, "utf8");
|
|
6276
6276
|
const releasedBufObj = releaseWritingBuf(buf, this._len, n);
|
|
6277
6277
|
buf = releasedBufObj.writingBuf;
|
|
6278
6278
|
this._len = releasedBufObj.len;
|
|
@@ -6288,7 +6288,7 @@ var require_sonic_boom = __commonJS({
|
|
|
6288
6288
|
}
|
|
6289
6289
|
}
|
|
6290
6290
|
try {
|
|
6291
|
-
|
|
6291
|
+
fs7.fsyncSync(this.fd);
|
|
6292
6292
|
} catch {
|
|
6293
6293
|
}
|
|
6294
6294
|
}
|
|
@@ -6309,7 +6309,7 @@ var require_sonic_boom = __commonJS({
|
|
|
6309
6309
|
buf = mergeBuf(this._bufs[0], this._lens[0]);
|
|
6310
6310
|
}
|
|
6311
6311
|
try {
|
|
6312
|
-
const n =
|
|
6312
|
+
const n = fs7.writeSync(this.fd, buf);
|
|
6313
6313
|
buf = buf.subarray(n);
|
|
6314
6314
|
this._len = Math.max(this._len - n, 0);
|
|
6315
6315
|
if (buf.length <= 0) {
|
|
@@ -6337,13 +6337,13 @@ var require_sonic_boom = __commonJS({
|
|
|
6337
6337
|
this._writingBuf = this._writingBuf || this._bufs.shift() || "";
|
|
6338
6338
|
if (this.sync) {
|
|
6339
6339
|
try {
|
|
6340
|
-
const written =
|
|
6340
|
+
const written = fs7.writeSync(this.fd, this._writingBuf, "utf8");
|
|
6341
6341
|
release(null, written);
|
|
6342
6342
|
} catch (err) {
|
|
6343
6343
|
release(err);
|
|
6344
6344
|
}
|
|
6345
6345
|
} else {
|
|
6346
|
-
|
|
6346
|
+
fs7.write(this.fd, this._writingBuf, "utf8", release);
|
|
6347
6347
|
}
|
|
6348
6348
|
}
|
|
6349
6349
|
function actualWriteBuffer() {
|
|
@@ -6352,7 +6352,7 @@ var require_sonic_boom = __commonJS({
|
|
|
6352
6352
|
this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
|
|
6353
6353
|
if (this.sync) {
|
|
6354
6354
|
try {
|
|
6355
|
-
const written =
|
|
6355
|
+
const written = fs7.writeSync(this.fd, this._writingBuf);
|
|
6356
6356
|
release(null, written);
|
|
6357
6357
|
} catch (err) {
|
|
6358
6358
|
release(err);
|
|
@@ -6361,7 +6361,7 @@ var require_sonic_boom = __commonJS({
|
|
|
6361
6361
|
if (kCopyBuffer) {
|
|
6362
6362
|
this._writingBuf = Buffer.from(this._writingBuf);
|
|
6363
6363
|
}
|
|
6364
|
-
|
|
6364
|
+
fs7.write(this.fd, this._writingBuf, release);
|
|
6365
6365
|
}
|
|
6366
6366
|
}
|
|
6367
6367
|
function actualClose(sonic) {
|
|
@@ -6377,12 +6377,12 @@ var require_sonic_boom = __commonJS({
|
|
|
6377
6377
|
sonic._lens = [];
|
|
6378
6378
|
assert(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
|
|
6379
6379
|
try {
|
|
6380
|
-
|
|
6380
|
+
fs7.fsync(sonic.fd, closeWrapped);
|
|
6381
6381
|
} catch {
|
|
6382
6382
|
}
|
|
6383
6383
|
function closeWrapped() {
|
|
6384
6384
|
if (sonic.fd !== 1 && sonic.fd !== 2) {
|
|
6385
|
-
|
|
6385
|
+
fs7.close(sonic.fd, done);
|
|
6386
6386
|
} else {
|
|
6387
6387
|
done();
|
|
6388
6388
|
}
|
|
@@ -7628,9 +7628,9 @@ var require_levels = __commonJS({
|
|
|
7628
7628
|
const { levels, levelVal } = this;
|
|
7629
7629
|
return levels && levels.labels ? levels.labels[levelVal] : "";
|
|
7630
7630
|
}
|
|
7631
|
-
function isLevelEnabled(
|
|
7631
|
+
function isLevelEnabled(logLevel2) {
|
|
7632
7632
|
const { values } = this.levels;
|
|
7633
|
-
const logLevelVal = values[
|
|
7633
|
+
const logLevelVal = values[logLevel2];
|
|
7634
7634
|
return logLevelVal !== void 0 && this[levelCompSym](logLevelVal, this[levelValSym]);
|
|
7635
7635
|
}
|
|
7636
7636
|
function compareLevel(direction, current, expected) {
|
|
@@ -11958,7 +11958,7 @@ var require_context = __commonJS({
|
|
|
11958
11958
|
childLoggerFactory,
|
|
11959
11959
|
errorHandler,
|
|
11960
11960
|
bodyLimit,
|
|
11961
|
-
logLevel,
|
|
11961
|
+
logLevel: logLevel2,
|
|
11962
11962
|
logSerializers,
|
|
11963
11963
|
attachValidation,
|
|
11964
11964
|
validatorCompiler,
|
|
@@ -11993,7 +11993,7 @@ var require_context = __commonJS({
|
|
|
11993
11993
|
};
|
|
11994
11994
|
this.exposeHeadRoute = exposeHeadRoute;
|
|
11995
11995
|
this.prefixTrailingSlash = prefixTrailingSlash;
|
|
11996
|
-
this.logLevel =
|
|
11996
|
+
this.logLevel = logLevel2 || server[kLogLevel];
|
|
11997
11997
|
this.logSerializers = logSerializers;
|
|
11998
11998
|
this[kFourOhFourContext] = null;
|
|
11999
11999
|
this.attachValidation = attachValidation;
|
|
@@ -16241,9 +16241,9 @@ var require_validate = __commonJS({
|
|
|
16241
16241
|
}
|
|
16242
16242
|
let expr = data;
|
|
16243
16243
|
const segments = jsonPointer.split("/");
|
|
16244
|
-
for (const
|
|
16245
|
-
if (
|
|
16246
|
-
data = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)((0, util_1.unescapeJsonPointer)(
|
|
16244
|
+
for (const segment2 of segments) {
|
|
16245
|
+
if (segment2) {
|
|
16246
|
+
data = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)((0, util_1.unescapeJsonPointer)(segment2))}`;
|
|
16247
16247
|
expr = (0, codegen_1._)`${expr} && ${data}`;
|
|
16248
16248
|
}
|
|
16249
16249
|
}
|
|
@@ -16838,8 +16838,8 @@ var require_schemes = __commonJS({
|
|
|
16838
16838
|
wsComponents.secure = void 0;
|
|
16839
16839
|
}
|
|
16840
16840
|
if (wsComponents.resourceName) {
|
|
16841
|
-
const [
|
|
16842
|
-
wsComponents.path =
|
|
16841
|
+
const [path7, query] = wsComponents.resourceName.split("?");
|
|
16842
|
+
wsComponents.path = path7 && path7 !== "/" ? path7 : void 0;
|
|
16843
16843
|
wsComponents.query = query;
|
|
16844
16844
|
wsComponents.resourceName = void 0;
|
|
16845
16845
|
}
|
|
@@ -20155,12 +20155,12 @@ var require_dist2 = __commonJS({
|
|
|
20155
20155
|
throw new Error(`Unknown format "${name}"`);
|
|
20156
20156
|
return f;
|
|
20157
20157
|
};
|
|
20158
|
-
function addFormats(ajv, list,
|
|
20158
|
+
function addFormats(ajv, list, fs7, exportName) {
|
|
20159
20159
|
var _a;
|
|
20160
20160
|
var _b;
|
|
20161
20161
|
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
20162
20162
|
for (const f of list)
|
|
20163
|
-
ajv.addFormat(f,
|
|
20163
|
+
ajv.addFormat(f, fs7[f]);
|
|
20164
20164
|
}
|
|
20165
20165
|
module2.exports = exports2 = formatsPlugin;
|
|
20166
20166
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -28834,40 +28834,40 @@ var require_node = __commonJS({
|
|
|
28834
28834
|
super();
|
|
28835
28835
|
this.staticChildren = {};
|
|
28836
28836
|
}
|
|
28837
|
-
findStaticMatchingChild(
|
|
28838
|
-
const staticChild = this.staticChildren[
|
|
28839
|
-
if (staticChild === void 0 || !staticChild.matchPrefix(
|
|
28837
|
+
findStaticMatchingChild(path7, pathIndex) {
|
|
28838
|
+
const staticChild = this.staticChildren[path7.charAt(pathIndex)];
|
|
28839
|
+
if (staticChild === void 0 || !staticChild.matchPrefix(path7, pathIndex)) {
|
|
28840
28840
|
return null;
|
|
28841
28841
|
}
|
|
28842
28842
|
return staticChild;
|
|
28843
28843
|
}
|
|
28844
|
-
getStaticChild(
|
|
28845
|
-
if (
|
|
28844
|
+
getStaticChild(path7, pathIndex = 0) {
|
|
28845
|
+
if (path7.length === pathIndex) {
|
|
28846
28846
|
return this;
|
|
28847
28847
|
}
|
|
28848
|
-
const staticChild = this.findStaticMatchingChild(
|
|
28848
|
+
const staticChild = this.findStaticMatchingChild(path7, pathIndex);
|
|
28849
28849
|
if (staticChild) {
|
|
28850
|
-
return staticChild.getStaticChild(
|
|
28850
|
+
return staticChild.getStaticChild(path7, pathIndex + staticChild.prefix.length);
|
|
28851
28851
|
}
|
|
28852
28852
|
return null;
|
|
28853
28853
|
}
|
|
28854
|
-
createStaticChild(
|
|
28855
|
-
if (
|
|
28854
|
+
createStaticChild(path7) {
|
|
28855
|
+
if (path7.length === 0) {
|
|
28856
28856
|
return this;
|
|
28857
28857
|
}
|
|
28858
|
-
let staticChild = this.staticChildren[
|
|
28858
|
+
let staticChild = this.staticChildren[path7.charAt(0)];
|
|
28859
28859
|
if (staticChild) {
|
|
28860
28860
|
let i = 1;
|
|
28861
28861
|
for (; i < staticChild.prefix.length; i++) {
|
|
28862
|
-
if (
|
|
28862
|
+
if (path7.charCodeAt(i) !== staticChild.prefix.charCodeAt(i)) {
|
|
28863
28863
|
staticChild = staticChild.split(this, i);
|
|
28864
28864
|
break;
|
|
28865
28865
|
}
|
|
28866
28866
|
}
|
|
28867
|
-
return staticChild.createStaticChild(
|
|
28867
|
+
return staticChild.createStaticChild(path7.slice(i));
|
|
28868
28868
|
}
|
|
28869
|
-
const label =
|
|
28870
|
-
this.staticChildren[label] = new StaticNode(
|
|
28869
|
+
const label = path7.charAt(0);
|
|
28870
|
+
this.staticChildren[label] = new StaticNode(path7);
|
|
28871
28871
|
return this.staticChildren[label];
|
|
28872
28872
|
}
|
|
28873
28873
|
};
|
|
@@ -28927,8 +28927,8 @@ var require_node = __commonJS({
|
|
|
28927
28927
|
parentNode.staticChildren[parentPrefix.charAt(0)] = staticNode;
|
|
28928
28928
|
return staticNode;
|
|
28929
28929
|
}
|
|
28930
|
-
getNextNode(
|
|
28931
|
-
let node = this.findStaticMatchingChild(
|
|
28930
|
+
getNextNode(path7, pathIndex, nodeStack, paramsCount) {
|
|
28931
|
+
let node = this.findStaticMatchingChild(path7, pathIndex);
|
|
28932
28932
|
let parametricBrotherNodeIndex = 0;
|
|
28933
28933
|
if (node === null) {
|
|
28934
28934
|
if (this.parametricChildren.length === 0) {
|
|
@@ -28975,8 +28975,8 @@ var require_node = __commonJS({
|
|
|
28975
28975
|
this.kind = NODE_TYPES.PARAMETRIC;
|
|
28976
28976
|
this.nodePaths = /* @__PURE__ */ new Set([nodePath]);
|
|
28977
28977
|
}
|
|
28978
|
-
getNextNode(
|
|
28979
|
-
return this.findStaticMatchingChild(
|
|
28978
|
+
getNextNode(path7, pathIndex) {
|
|
28979
|
+
return this.findStaticMatchingChild(path7, pathIndex);
|
|
28980
28980
|
}
|
|
28981
28981
|
};
|
|
28982
28982
|
var WildcardNode = class extends Node {
|
|
@@ -29312,33 +29312,33 @@ var require_url_sanitizer = __commonJS({
|
|
|
29312
29312
|
}
|
|
29313
29313
|
return null;
|
|
29314
29314
|
}
|
|
29315
|
-
function safeDecodeURI(
|
|
29315
|
+
function safeDecodeURI(path7, useSemicolonDelimiter) {
|
|
29316
29316
|
let shouldDecode = false;
|
|
29317
29317
|
let shouldDecodeParam = false;
|
|
29318
29318
|
let querystring = "";
|
|
29319
|
-
for (let i = 1; i <
|
|
29320
|
-
const charCode =
|
|
29319
|
+
for (let i = 1; i < path7.length; i++) {
|
|
29320
|
+
const charCode = path7.charCodeAt(i);
|
|
29321
29321
|
if (charCode === 37) {
|
|
29322
|
-
const highCharCode =
|
|
29323
|
-
const lowCharCode =
|
|
29322
|
+
const highCharCode = path7.charCodeAt(i + 1);
|
|
29323
|
+
const lowCharCode = path7.charCodeAt(i + 2);
|
|
29324
29324
|
if (decodeComponentChar(highCharCode, lowCharCode) === null) {
|
|
29325
29325
|
shouldDecode = true;
|
|
29326
29326
|
} else {
|
|
29327
29327
|
shouldDecodeParam = true;
|
|
29328
29328
|
if (highCharCode === 50 && lowCharCode === 53) {
|
|
29329
29329
|
shouldDecode = true;
|
|
29330
|
-
|
|
29330
|
+
path7 = path7.slice(0, i + 1) + "25" + path7.slice(i + 1);
|
|
29331
29331
|
i += 2;
|
|
29332
29332
|
}
|
|
29333
29333
|
i += 2;
|
|
29334
29334
|
}
|
|
29335
29335
|
} else if (charCode === 63 || charCode === 35 || charCode === 59 && useSemicolonDelimiter) {
|
|
29336
|
-
querystring =
|
|
29337
|
-
|
|
29336
|
+
querystring = path7.slice(i + 1);
|
|
29337
|
+
path7 = path7.slice(0, i);
|
|
29338
29338
|
break;
|
|
29339
29339
|
}
|
|
29340
29340
|
}
|
|
29341
|
-
const decodedPath = shouldDecode ? decodeURI(
|
|
29341
|
+
const decodedPath = shouldDecode ? decodeURI(path7) : path7;
|
|
29342
29342
|
return { path: decodedPath, querystring, shouldDecodeParam };
|
|
29343
29343
|
}
|
|
29344
29344
|
function safeDecodeURIComponent(uriComponent) {
|
|
@@ -29431,7 +29431,7 @@ var require_find_my_way = __commonJS({
|
|
|
29431
29431
|
this.routes = [];
|
|
29432
29432
|
this.trees = {};
|
|
29433
29433
|
}
|
|
29434
|
-
Router.prototype.on = function on(method,
|
|
29434
|
+
Router.prototype.on = function on(method, path7, opts, handler, store) {
|
|
29435
29435
|
if (typeof opts === "function") {
|
|
29436
29436
|
if (handler !== void 0) {
|
|
29437
29437
|
store = handler;
|
|
@@ -29439,34 +29439,34 @@ var require_find_my_way = __commonJS({
|
|
|
29439
29439
|
handler = opts;
|
|
29440
29440
|
opts = {};
|
|
29441
29441
|
}
|
|
29442
|
-
assert(typeof
|
|
29443
|
-
assert(
|
|
29444
|
-
assert(
|
|
29442
|
+
assert(typeof path7 === "string", "Path should be a string");
|
|
29443
|
+
assert(path7.length > 0, "The path could not be empty");
|
|
29444
|
+
assert(path7[0] === "/" || path7[0] === "*", "The first character of a path should be `/` or `*`");
|
|
29445
29445
|
assert(typeof handler === "function", "Handler should be a function");
|
|
29446
|
-
const optionalParamMatch =
|
|
29446
|
+
const optionalParamMatch = path7.match(OPTIONAL_PARAM_REGEXP);
|
|
29447
29447
|
if (optionalParamMatch) {
|
|
29448
|
-
assert(
|
|
29449
|
-
const pathFull =
|
|
29450
|
-
const pathOptional =
|
|
29448
|
+
assert(path7.length === optionalParamMatch.index + optionalParamMatch[0].length, "Optional Parameter needs to be the last parameter of the path");
|
|
29449
|
+
const pathFull = path7.replace(OPTIONAL_PARAM_REGEXP, "$1$2");
|
|
29450
|
+
const pathOptional = path7.replace(OPTIONAL_PARAM_REGEXP, "$2") || "/";
|
|
29451
29451
|
this.on(method, pathFull, opts, handler, store);
|
|
29452
29452
|
this.on(method, pathOptional, opts, handler, store);
|
|
29453
29453
|
return;
|
|
29454
29454
|
}
|
|
29455
|
-
const route =
|
|
29455
|
+
const route = path7;
|
|
29456
29456
|
if (this.ignoreDuplicateSlashes) {
|
|
29457
|
-
|
|
29457
|
+
path7 = removeDuplicateSlashes(path7);
|
|
29458
29458
|
}
|
|
29459
29459
|
if (this.ignoreTrailingSlash) {
|
|
29460
|
-
|
|
29460
|
+
path7 = trimLastSlash(path7);
|
|
29461
29461
|
}
|
|
29462
29462
|
const methods = Array.isArray(method) ? method : [method];
|
|
29463
29463
|
for (const method2 of methods) {
|
|
29464
29464
|
assert(typeof method2 === "string", "Method should be a string");
|
|
29465
29465
|
assert(httpMethods.includes(method2), `Method '${method2}' is not an http method.`);
|
|
29466
|
-
this._on(method2,
|
|
29466
|
+
this._on(method2, path7, opts, handler, store, route);
|
|
29467
29467
|
}
|
|
29468
29468
|
};
|
|
29469
|
-
Router.prototype._on = function _on(method,
|
|
29469
|
+
Router.prototype._on = function _on(method, path7, opts, handler, store) {
|
|
29470
29470
|
let constraints = {};
|
|
29471
29471
|
if (opts.constraints !== void 0) {
|
|
29472
29472
|
assert(typeof opts.constraints === "object" && opts.constraints !== null, "Constraints should be an object");
|
|
@@ -29479,7 +29479,7 @@ var require_find_my_way = __commonJS({
|
|
|
29479
29479
|
if (this.trees[method] === void 0) {
|
|
29480
29480
|
this.trees[method] = new StaticNode("/");
|
|
29481
29481
|
}
|
|
29482
|
-
let pattern =
|
|
29482
|
+
let pattern = path7;
|
|
29483
29483
|
if (pattern === "*" && this.trees[method].prefix.length !== 0) {
|
|
29484
29484
|
const currentRoot = this.trees[method];
|
|
29485
29485
|
this.trees[method] = new StaticNode("");
|
|
@@ -29582,19 +29582,19 @@ var require_find_my_way = __commonJS({
|
|
|
29582
29582
|
throw new Error(`Method '${method}' already declared for route '${pattern}' with constraints '${JSON.stringify(constraints)}'`);
|
|
29583
29583
|
}
|
|
29584
29584
|
}
|
|
29585
|
-
const route = { method, path:
|
|
29585
|
+
const route = { method, path: path7, pattern, params, opts, handler, store };
|
|
29586
29586
|
this.routes.push(route);
|
|
29587
29587
|
currentNode.addRoute(route, this.constrainer);
|
|
29588
29588
|
};
|
|
29589
|
-
Router.prototype.hasRoute = function hasRoute(method,
|
|
29590
|
-
const route = this.findRoute(method,
|
|
29589
|
+
Router.prototype.hasRoute = function hasRoute(method, path7, constraints) {
|
|
29590
|
+
const route = this.findRoute(method, path7, constraints);
|
|
29591
29591
|
return route !== null;
|
|
29592
29592
|
};
|
|
29593
|
-
Router.prototype.findRoute = function findNode(method,
|
|
29593
|
+
Router.prototype.findRoute = function findNode(method, path7, constraints = {}) {
|
|
29594
29594
|
if (this.trees[method] === void 0) {
|
|
29595
29595
|
return null;
|
|
29596
29596
|
}
|
|
29597
|
-
let pattern =
|
|
29597
|
+
let pattern = path7;
|
|
29598
29598
|
let currentNode = this.trees[method];
|
|
29599
29599
|
let parentNodePathIndex = currentNode.prefix.length;
|
|
29600
29600
|
const params = [];
|
|
@@ -29712,39 +29712,39 @@ var require_find_my_way = __commonJS({
|
|
|
29712
29712
|
this.trees = {};
|
|
29713
29713
|
this.routes = [];
|
|
29714
29714
|
};
|
|
29715
|
-
Router.prototype.off = function off(method,
|
|
29716
|
-
assert(typeof
|
|
29717
|
-
assert(
|
|
29718
|
-
assert(
|
|
29715
|
+
Router.prototype.off = function off(method, path7, constraints) {
|
|
29716
|
+
assert(typeof path7 === "string", "Path should be a string");
|
|
29717
|
+
assert(path7.length > 0, "The path could not be empty");
|
|
29718
|
+
assert(path7[0] === "/" || path7[0] === "*", "The first character of a path should be `/` or `*`");
|
|
29719
29719
|
assert(
|
|
29720
29720
|
typeof constraints === "undefined" || typeof constraints === "object" && !Array.isArray(constraints) && constraints !== null,
|
|
29721
29721
|
"Constraints should be an object or undefined."
|
|
29722
29722
|
);
|
|
29723
|
-
const optionalParamMatch =
|
|
29723
|
+
const optionalParamMatch = path7.match(OPTIONAL_PARAM_REGEXP);
|
|
29724
29724
|
if (optionalParamMatch) {
|
|
29725
|
-
assert(
|
|
29726
|
-
const pathFull =
|
|
29727
|
-
const pathOptional =
|
|
29725
|
+
assert(path7.length === optionalParamMatch.index + optionalParamMatch[0].length, "Optional Parameter needs to be the last parameter of the path");
|
|
29726
|
+
const pathFull = path7.replace(OPTIONAL_PARAM_REGEXP, "$1$2");
|
|
29727
|
+
const pathOptional = path7.replace(OPTIONAL_PARAM_REGEXP, "$2");
|
|
29728
29728
|
this.off(method, pathFull, constraints);
|
|
29729
29729
|
this.off(method, pathOptional, constraints);
|
|
29730
29730
|
return;
|
|
29731
29731
|
}
|
|
29732
29732
|
if (this.ignoreDuplicateSlashes) {
|
|
29733
|
-
|
|
29733
|
+
path7 = removeDuplicateSlashes(path7);
|
|
29734
29734
|
}
|
|
29735
29735
|
if (this.ignoreTrailingSlash) {
|
|
29736
|
-
|
|
29736
|
+
path7 = trimLastSlash(path7);
|
|
29737
29737
|
}
|
|
29738
29738
|
const methods = Array.isArray(method) ? method : [method];
|
|
29739
29739
|
for (const method2 of methods) {
|
|
29740
|
-
this._off(method2,
|
|
29740
|
+
this._off(method2, path7, constraints);
|
|
29741
29741
|
}
|
|
29742
29742
|
};
|
|
29743
|
-
Router.prototype._off = function _off(method,
|
|
29743
|
+
Router.prototype._off = function _off(method, path7, constraints) {
|
|
29744
29744
|
assert(typeof method === "string", "Method should be a string");
|
|
29745
29745
|
assert(httpMethods.includes(method), `Method '${method}' is not an http method.`);
|
|
29746
29746
|
function matcherWithoutConstraints(route) {
|
|
29747
|
-
return method !== route.method ||
|
|
29747
|
+
return method !== route.method || path7 !== route.path;
|
|
29748
29748
|
}
|
|
29749
29749
|
function matcherWithConstraints(route) {
|
|
29750
29750
|
return matcherWithoutConstraints(route) || !deepEqual(constraints, route.opts.constraints || {});
|
|
@@ -29781,37 +29781,37 @@ var require_find_my_way = __commonJS({
|
|
|
29781
29781
|
if (handle === null) return this._defaultRoute(req, res, ctx);
|
|
29782
29782
|
return ctx === void 0 ? handle.handler(req, res, handle.params, handle.store, handle.searchParams) : handle.handler.call(ctx, req, res, handle.params, handle.store, handle.searchParams);
|
|
29783
29783
|
};
|
|
29784
|
-
Router.prototype.find = function find(method,
|
|
29784
|
+
Router.prototype.find = function find(method, path7, derivedConstraints) {
|
|
29785
29785
|
let currentNode = this.trees[method];
|
|
29786
29786
|
if (currentNode === void 0) return null;
|
|
29787
|
-
if (
|
|
29788
|
-
|
|
29787
|
+
if (path7.charCodeAt(0) !== 47) {
|
|
29788
|
+
path7 = path7.replace(FULL_PATH_REGEXP, "/");
|
|
29789
29789
|
}
|
|
29790
29790
|
if (this.ignoreDuplicateSlashes) {
|
|
29791
|
-
|
|
29791
|
+
path7 = removeDuplicateSlashes(path7);
|
|
29792
29792
|
}
|
|
29793
29793
|
let sanitizedUrl;
|
|
29794
29794
|
let querystring2;
|
|
29795
29795
|
let shouldDecodeParam;
|
|
29796
29796
|
try {
|
|
29797
|
-
sanitizedUrl = safeDecodeURI(
|
|
29798
|
-
|
|
29797
|
+
sanitizedUrl = safeDecodeURI(path7, this.useSemicolonDelimiter);
|
|
29798
|
+
path7 = sanitizedUrl.path;
|
|
29799
29799
|
querystring2 = sanitizedUrl.querystring;
|
|
29800
29800
|
shouldDecodeParam = sanitizedUrl.shouldDecodeParam;
|
|
29801
29801
|
} catch (error) {
|
|
29802
|
-
return this._onBadUrl(
|
|
29802
|
+
return this._onBadUrl(path7);
|
|
29803
29803
|
}
|
|
29804
29804
|
if (this.ignoreTrailingSlash) {
|
|
29805
|
-
|
|
29805
|
+
path7 = trimLastSlash(path7);
|
|
29806
29806
|
}
|
|
29807
|
-
const originPath =
|
|
29807
|
+
const originPath = path7;
|
|
29808
29808
|
if (this.caseSensitive === false) {
|
|
29809
|
-
|
|
29809
|
+
path7 = path7.toLowerCase();
|
|
29810
29810
|
}
|
|
29811
29811
|
const maxParamLength = this.maxParamLength;
|
|
29812
29812
|
let pathIndex = currentNode.prefix.length;
|
|
29813
29813
|
const params = [];
|
|
29814
|
-
const pathLen =
|
|
29814
|
+
const pathLen = path7.length;
|
|
29815
29815
|
const brothersNodesStack = [];
|
|
29816
29816
|
while (true) {
|
|
29817
29817
|
if (pathIndex === pathLen && currentNode.isLeafNode) {
|
|
@@ -29825,7 +29825,7 @@ var require_find_my_way = __commonJS({
|
|
|
29825
29825
|
};
|
|
29826
29826
|
}
|
|
29827
29827
|
}
|
|
29828
|
-
let node = currentNode.getNextNode(
|
|
29828
|
+
let node = currentNode.getNextNode(path7, pathIndex, brothersNodesStack, params.length);
|
|
29829
29829
|
if (node === null) {
|
|
29830
29830
|
if (brothersNodesStack.length === 0) {
|
|
29831
29831
|
return null;
|
|
@@ -29879,8 +29879,8 @@ var require_find_my_way = __commonJS({
|
|
|
29879
29879
|
Router.prototype._rebuild = function(routes) {
|
|
29880
29880
|
this.reset();
|
|
29881
29881
|
for (const route of routes) {
|
|
29882
|
-
const { method, path:
|
|
29883
|
-
this._on(method,
|
|
29882
|
+
const { method, path: path7, opts, handler, store } = route;
|
|
29883
|
+
this._on(method, path7, opts, handler, store);
|
|
29884
29884
|
}
|
|
29885
29885
|
};
|
|
29886
29886
|
Router.prototype._defaultRoute = function(req, res, ctx) {
|
|
@@ -29891,13 +29891,13 @@ var require_find_my_way = __commonJS({
|
|
|
29891
29891
|
res.end();
|
|
29892
29892
|
}
|
|
29893
29893
|
};
|
|
29894
|
-
Router.prototype._onBadUrl = function(
|
|
29894
|
+
Router.prototype._onBadUrl = function(path7) {
|
|
29895
29895
|
if (this.onBadUrl === null) {
|
|
29896
29896
|
return null;
|
|
29897
29897
|
}
|
|
29898
29898
|
const onBadUrl = this.onBadUrl;
|
|
29899
29899
|
return {
|
|
29900
|
-
handler: (req, res, ctx) => onBadUrl(
|
|
29900
|
+
handler: (req, res, ctx) => onBadUrl(path7, req, res),
|
|
29901
29901
|
params: {},
|
|
29902
29902
|
store: null
|
|
29903
29903
|
};
|
|
@@ -29929,25 +29929,25 @@ var require_find_my_way = __commonJS({
|
|
|
29929
29929
|
if (!httpMethods.hasOwnProperty(i)) continue;
|
|
29930
29930
|
const m = httpMethods[i];
|
|
29931
29931
|
const methodName = m.toLowerCase();
|
|
29932
|
-
Router.prototype[methodName] = function(
|
|
29933
|
-
return this.on(m,
|
|
29932
|
+
Router.prototype[methodName] = function(path7, handler, store) {
|
|
29933
|
+
return this.on(m, path7, handler, store);
|
|
29934
29934
|
};
|
|
29935
29935
|
}
|
|
29936
|
-
Router.prototype.all = function(
|
|
29937
|
-
this.on(httpMethods,
|
|
29936
|
+
Router.prototype.all = function(path7, handler, store) {
|
|
29937
|
+
this.on(httpMethods, path7, handler, store);
|
|
29938
29938
|
};
|
|
29939
29939
|
module2.exports = Router;
|
|
29940
29940
|
function escapeRegExp(string) {
|
|
29941
29941
|
return string.replace(ESCAPE_REGEXP, "\\$&");
|
|
29942
29942
|
}
|
|
29943
|
-
function removeDuplicateSlashes(
|
|
29944
|
-
return
|
|
29943
|
+
function removeDuplicateSlashes(path7) {
|
|
29944
|
+
return path7.indexOf("//") !== -1 ? path7.replace(REMOVE_DUPLICATE_SLASHES_REGEXP, "/") : path7;
|
|
29945
29945
|
}
|
|
29946
|
-
function trimLastSlash(
|
|
29947
|
-
if (
|
|
29948
|
-
return
|
|
29946
|
+
function trimLastSlash(path7) {
|
|
29947
|
+
if (path7.length > 1 && path7.charCodeAt(path7.length - 1) === 47) {
|
|
29948
|
+
return path7.slice(0, -1);
|
|
29949
29949
|
}
|
|
29950
|
-
return
|
|
29950
|
+
return path7;
|
|
29951
29951
|
}
|
|
29952
29952
|
function trimRegExpStartAndEnd(regexString) {
|
|
29953
29953
|
if (regexString.charCodeAt(1) === 94) {
|
|
@@ -29958,22 +29958,22 @@ var require_find_my_way = __commonJS({
|
|
|
29958
29958
|
}
|
|
29959
29959
|
return regexString;
|
|
29960
29960
|
}
|
|
29961
|
-
function getClosingParenthensePosition(
|
|
29961
|
+
function getClosingParenthensePosition(path7, idx) {
|
|
29962
29962
|
let parentheses = 1;
|
|
29963
|
-
while (idx <
|
|
29963
|
+
while (idx < path7.length) {
|
|
29964
29964
|
idx++;
|
|
29965
|
-
if (
|
|
29965
|
+
if (path7.charCodeAt(idx) === 92) {
|
|
29966
29966
|
idx++;
|
|
29967
29967
|
continue;
|
|
29968
29968
|
}
|
|
29969
|
-
if (
|
|
29969
|
+
if (path7.charCodeAt(idx) === 41) {
|
|
29970
29970
|
parentheses--;
|
|
29971
|
-
} else if (
|
|
29971
|
+
} else if (path7.charCodeAt(idx) === 40) {
|
|
29972
29972
|
parentheses++;
|
|
29973
29973
|
}
|
|
29974
29974
|
if (!parentheses) return idx;
|
|
29975
29975
|
}
|
|
29976
|
-
throw new TypeError('Invalid regexp expression in "' +
|
|
29976
|
+
throw new TypeError('Invalid regexp expression in "' + path7 + '"');
|
|
29977
29977
|
}
|
|
29978
29978
|
function defaultBuildPrettyMeta(route) {
|
|
29979
29979
|
if (!route) return {};
|
|
@@ -30180,12 +30180,12 @@ var require_route = __commonJS({
|
|
|
30180
30180
|
function route({ options: options2, isFastify }) {
|
|
30181
30181
|
throwIfAlreadyStarted("Cannot add route!");
|
|
30182
30182
|
const opts = { ...options2 };
|
|
30183
|
-
const
|
|
30183
|
+
const path7 = opts.url || opts.path || "";
|
|
30184
30184
|
if (!opts.handler) {
|
|
30185
|
-
throw new FST_ERR_ROUTE_MISSING_HANDLER(opts.method,
|
|
30185
|
+
throw new FST_ERR_ROUTE_MISSING_HANDLER(opts.method, path7);
|
|
30186
30186
|
}
|
|
30187
30187
|
if (opts.errorHandler !== void 0 && typeof opts.errorHandler !== "function") {
|
|
30188
|
-
throw new FST_ERR_ROUTE_HANDLER_NOT_FN(opts.method,
|
|
30188
|
+
throw new FST_ERR_ROUTE_HANDLER_NOT_FN(opts.method, path7);
|
|
30189
30189
|
}
|
|
30190
30190
|
validateBodyLimitOption(opts.bodyLimit);
|
|
30191
30191
|
const shouldExposeHead = opts.exposeHeadRoute ?? globalExposeHeadRoutes;
|
|
@@ -30194,22 +30194,22 @@ var require_route = __commonJS({
|
|
|
30194
30194
|
if (Array.isArray(opts.method)) {
|
|
30195
30195
|
for (let i = 0; i < opts.method.length; ++i) {
|
|
30196
30196
|
opts.method[i] = normalizeAndValidateMethod.call(this, opts.method[i]);
|
|
30197
|
-
validateSchemaBodyOption.call(this, opts.method[i],
|
|
30197
|
+
validateSchemaBodyOption.call(this, opts.method[i], path7, opts.schema);
|
|
30198
30198
|
isGetRoute = opts.method.includes("GET");
|
|
30199
30199
|
isHeadRoute = opts.method.includes("HEAD");
|
|
30200
30200
|
}
|
|
30201
30201
|
} else {
|
|
30202
30202
|
opts.method = normalizeAndValidateMethod.call(this, opts.method);
|
|
30203
|
-
validateSchemaBodyOption.call(this, opts.method,
|
|
30203
|
+
validateSchemaBodyOption.call(this, opts.method, path7, opts.schema);
|
|
30204
30204
|
isGetRoute = opts.method === "GET";
|
|
30205
30205
|
isHeadRoute = opts.method === "HEAD";
|
|
30206
30206
|
}
|
|
30207
30207
|
const headOpts = shouldExposeHead && isGetRoute ? { ...options2 } : null;
|
|
30208
30208
|
const prefix = this[kRoutePrefix];
|
|
30209
|
-
if (
|
|
30209
|
+
if (path7 === "/" && prefix.length > 0 && opts.method !== "HEAD") {
|
|
30210
30210
|
switch (opts.prefixTrailingSlash) {
|
|
30211
30211
|
case "slash":
|
|
30212
|
-
addNewRoute.call(this, { path:
|
|
30212
|
+
addNewRoute.call(this, { path: path7, isFastify });
|
|
30213
30213
|
break;
|
|
30214
30214
|
case "no-slash":
|
|
30215
30215
|
addNewRoute.call(this, { path: "", isFastify });
|
|
@@ -30218,20 +30218,20 @@ var require_route = __commonJS({
|
|
|
30218
30218
|
default:
|
|
30219
30219
|
addNewRoute.call(this, { path: "", isFastify });
|
|
30220
30220
|
if (ignoreTrailingSlash !== true && (ignoreDuplicateSlashes !== true || !prefix.endsWith("/"))) {
|
|
30221
|
-
addNewRoute.call(this, { path:
|
|
30221
|
+
addNewRoute.call(this, { path: path7, prefixing: true, isFastify });
|
|
30222
30222
|
}
|
|
30223
30223
|
}
|
|
30224
|
-
} else if (
|
|
30225
|
-
addNewRoute.call(this, { path:
|
|
30224
|
+
} else if (path7[0] === "/" && prefix.endsWith("/")) {
|
|
30225
|
+
addNewRoute.call(this, { path: path7.slice(1), isFastify });
|
|
30226
30226
|
} else {
|
|
30227
|
-
addNewRoute.call(this, { path:
|
|
30227
|
+
addNewRoute.call(this, { path: path7, isFastify });
|
|
30228
30228
|
}
|
|
30229
30229
|
return this;
|
|
30230
|
-
function addNewRoute({ path:
|
|
30231
|
-
const url = prefix +
|
|
30230
|
+
function addNewRoute({ path: path8, prefixing = false, isFastify: isFastify2 = false }) {
|
|
30231
|
+
const url = prefix + path8;
|
|
30232
30232
|
opts.url = url;
|
|
30233
30233
|
opts.path = url;
|
|
30234
|
-
opts.routePath =
|
|
30234
|
+
opts.routePath = path8;
|
|
30235
30235
|
opts.prefix = prefix;
|
|
30236
30236
|
opts.logLevel = opts.logLevel || this[kLogLevel];
|
|
30237
30237
|
if (this[kLogSerializers] || opts.logSerializers) {
|
|
@@ -30355,7 +30355,7 @@ var require_route = __commonJS({
|
|
|
30355
30355
|
});
|
|
30356
30356
|
if (shouldExposeHead && isGetRoute && !isHeadRoute && !hasHEADHandler) {
|
|
30357
30357
|
const onSendHandlers = parseHeadOnSendHandlers(headOpts.onSend);
|
|
30358
|
-
prepareRoute.call(this, { method: "HEAD", url:
|
|
30358
|
+
prepareRoute.call(this, { method: "HEAD", url: path8, options: { ...headOpts, onSend: onSendHandlers }, isFastify: true });
|
|
30359
30359
|
}
|
|
30360
30360
|
}
|
|
30361
30361
|
}
|
|
@@ -30456,9 +30456,9 @@ var require_route = __commonJS({
|
|
|
30456
30456
|
}
|
|
30457
30457
|
return method;
|
|
30458
30458
|
}
|
|
30459
|
-
function validateSchemaBodyOption(method,
|
|
30459
|
+
function validateSchemaBodyOption(method, path7, schema) {
|
|
30460
30460
|
if (this[kSupportedHTTPMethods].bodyless.has(method) && schema?.body) {
|
|
30461
|
-
throw new FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED(method,
|
|
30461
|
+
throw new FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED(method, path7);
|
|
30462
30462
|
}
|
|
30463
30463
|
}
|
|
30464
30464
|
function validateBodyLimitOption(bodyLimit) {
|
|
@@ -30537,7 +30537,7 @@ var require_fourOhFour = __commonJS({
|
|
|
30537
30537
|
});
|
|
30538
30538
|
}
|
|
30539
30539
|
function createOnBadUrl() {
|
|
30540
|
-
return function onBadUrl(
|
|
30540
|
+
return function onBadUrl(path7, req, res) {
|
|
30541
30541
|
const fourOhFourContext = this[kFourOhFourLevelInstance][kFourOhFourContext];
|
|
30542
30542
|
const id = getGenReqId(fourOhFourContext.server, req);
|
|
30543
30543
|
const childLogger = createChildLogger(fourOhFourContext, logger, req, id);
|
|
@@ -34254,7 +34254,7 @@ ${body}`);
|
|
|
34254
34254
|
}
|
|
34255
34255
|
fourOhFour.router.lookup(req, res);
|
|
34256
34256
|
}
|
|
34257
|
-
function onBadUrl(
|
|
34257
|
+
function onBadUrl(path7, req, res) {
|
|
34258
34258
|
if (frameworkErrors) {
|
|
34259
34259
|
const id = getGenReqId(onBadUrlContext.server, req);
|
|
34260
34260
|
const childLogger = createChildLogger(onBadUrlContext, logger, req, id);
|
|
@@ -34263,9 +34263,9 @@ ${body}`);
|
|
|
34263
34263
|
if (disableRequestLogging === false) {
|
|
34264
34264
|
childLogger.info({ req: request }, "incoming request");
|
|
34265
34265
|
}
|
|
34266
|
-
return frameworkErrors(new FST_ERR_BAD_URL(
|
|
34266
|
+
return frameworkErrors(new FST_ERR_BAD_URL(path7), request, reply);
|
|
34267
34267
|
}
|
|
34268
|
-
const body = `{"error":"Bad Request","code":"FST_ERR_BAD_URL","message":"'${
|
|
34268
|
+
const body = `{"error":"Bad Request","code":"FST_ERR_BAD_URL","message":"'${path7}' is not a valid url component","statusCode":400}`;
|
|
34269
34269
|
res.writeHead(400, {
|
|
34270
34270
|
"Content-Type": "application/json",
|
|
34271
34271
|
"Content-Length": body.length
|
|
@@ -34894,8 +34894,8 @@ var require_package2 = __commonJS({
|
|
|
34894
34894
|
// node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/lib/main.js
|
|
34895
34895
|
var require_main = __commonJS({
|
|
34896
34896
|
"node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
34897
|
-
var
|
|
34898
|
-
var
|
|
34897
|
+
var fs7 = require("fs");
|
|
34898
|
+
var path7 = require("path");
|
|
34899
34899
|
var os2 = require("os");
|
|
34900
34900
|
var crypto2 = require("crypto");
|
|
34901
34901
|
var packageJson = require_package2();
|
|
@@ -35003,7 +35003,7 @@ var require_main = __commonJS({
|
|
|
35003
35003
|
if (options && options.path && options.path.length > 0) {
|
|
35004
35004
|
if (Array.isArray(options.path)) {
|
|
35005
35005
|
for (const filepath of options.path) {
|
|
35006
|
-
if (
|
|
35006
|
+
if (fs7.existsSync(filepath)) {
|
|
35007
35007
|
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
35008
35008
|
}
|
|
35009
35009
|
}
|
|
@@ -35011,15 +35011,15 @@ var require_main = __commonJS({
|
|
|
35011
35011
|
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
35012
35012
|
}
|
|
35013
35013
|
} else {
|
|
35014
|
-
possibleVaultPath =
|
|
35014
|
+
possibleVaultPath = path7.resolve(process.cwd(), ".env.vault");
|
|
35015
35015
|
}
|
|
35016
|
-
if (
|
|
35016
|
+
if (fs7.existsSync(possibleVaultPath)) {
|
|
35017
35017
|
return possibleVaultPath;
|
|
35018
35018
|
}
|
|
35019
35019
|
return null;
|
|
35020
35020
|
}
|
|
35021
35021
|
function _resolveHome(envPath) {
|
|
35022
|
-
return envPath[0] === "~" ?
|
|
35022
|
+
return envPath[0] === "~" ? path7.join(os2.homedir(), envPath.slice(1)) : envPath;
|
|
35023
35023
|
}
|
|
35024
35024
|
function _configVault(options) {
|
|
35025
35025
|
const debug = Boolean(options && options.debug);
|
|
@@ -35036,7 +35036,7 @@ var require_main = __commonJS({
|
|
|
35036
35036
|
return { parsed };
|
|
35037
35037
|
}
|
|
35038
35038
|
function configDotenv(options) {
|
|
35039
|
-
const dotenvPath =
|
|
35039
|
+
const dotenvPath = path7.resolve(process.cwd(), ".env");
|
|
35040
35040
|
let encoding = "utf8";
|
|
35041
35041
|
const debug = Boolean(options && options.debug);
|
|
35042
35042
|
const quiet = options && "quiet" in options ? options.quiet : true;
|
|
@@ -35060,13 +35060,13 @@ var require_main = __commonJS({
|
|
|
35060
35060
|
}
|
|
35061
35061
|
let lastError;
|
|
35062
35062
|
const parsedAll = {};
|
|
35063
|
-
for (const
|
|
35063
|
+
for (const path8 of optionPaths) {
|
|
35064
35064
|
try {
|
|
35065
|
-
const parsed = DotenvModule.parse(
|
|
35065
|
+
const parsed = DotenvModule.parse(fs7.readFileSync(path8, { encoding }));
|
|
35066
35066
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
35067
35067
|
} catch (e) {
|
|
35068
35068
|
if (debug) {
|
|
35069
|
-
_debug(`Failed to load ${
|
|
35069
|
+
_debug(`Failed to load ${path8} ${e.message}`);
|
|
35070
35070
|
}
|
|
35071
35071
|
lastError = e;
|
|
35072
35072
|
}
|
|
@@ -35081,7 +35081,7 @@ var require_main = __commonJS({
|
|
|
35081
35081
|
const shortPaths = [];
|
|
35082
35082
|
for (const filePath of optionPaths) {
|
|
35083
35083
|
try {
|
|
35084
|
-
const relative =
|
|
35084
|
+
const relative = path7.relative(process.cwd(), filePath);
|
|
35085
35085
|
shortPaths.push(relative);
|
|
35086
35086
|
} catch (e) {
|
|
35087
35087
|
if (debug) {
|
|
@@ -36095,14 +36095,14 @@ var require_util4 = __commonJS({
|
|
|
36095
36095
|
}
|
|
36096
36096
|
const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
|
|
36097
36097
|
let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
|
|
36098
|
-
let
|
|
36098
|
+
let path7 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
|
|
36099
36099
|
if (origin[origin.length - 1] === "/") {
|
|
36100
36100
|
origin = origin.slice(0, origin.length - 1);
|
|
36101
36101
|
}
|
|
36102
|
-
if (
|
|
36103
|
-
|
|
36102
|
+
if (path7 && path7[0] !== "/") {
|
|
36103
|
+
path7 = `/${path7}`;
|
|
36104
36104
|
}
|
|
36105
|
-
return new URL(`${origin}${
|
|
36105
|
+
return new URL(`${origin}${path7}`);
|
|
36106
36106
|
}
|
|
36107
36107
|
if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
|
|
36108
36108
|
throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -36650,9 +36650,9 @@ var require_diagnostics = __commonJS({
|
|
|
36650
36650
|
"undici:client:sendHeaders",
|
|
36651
36651
|
(evt) => {
|
|
36652
36652
|
const {
|
|
36653
|
-
request: { method, path:
|
|
36653
|
+
request: { method, path: path7, origin }
|
|
36654
36654
|
} = evt;
|
|
36655
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
36655
|
+
debugLog("sending request to %s %s%s", method, origin, path7);
|
|
36656
36656
|
}
|
|
36657
36657
|
);
|
|
36658
36658
|
}
|
|
@@ -36666,14 +36666,14 @@ var require_diagnostics = __commonJS({
|
|
|
36666
36666
|
"undici:request:headers",
|
|
36667
36667
|
(evt) => {
|
|
36668
36668
|
const {
|
|
36669
|
-
request: { method, path:
|
|
36669
|
+
request: { method, path: path7, origin },
|
|
36670
36670
|
response: { statusCode }
|
|
36671
36671
|
} = evt;
|
|
36672
36672
|
debugLog(
|
|
36673
36673
|
"received response to %s %s%s - HTTP %d",
|
|
36674
36674
|
method,
|
|
36675
36675
|
origin,
|
|
36676
|
-
|
|
36676
|
+
path7,
|
|
36677
36677
|
statusCode
|
|
36678
36678
|
);
|
|
36679
36679
|
}
|
|
@@ -36682,23 +36682,23 @@ var require_diagnostics = __commonJS({
|
|
|
36682
36682
|
"undici:request:trailers",
|
|
36683
36683
|
(evt) => {
|
|
36684
36684
|
const {
|
|
36685
|
-
request: { method, path:
|
|
36685
|
+
request: { method, path: path7, origin }
|
|
36686
36686
|
} = evt;
|
|
36687
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
36687
|
+
debugLog("trailers received from %s %s%s", method, origin, path7);
|
|
36688
36688
|
}
|
|
36689
36689
|
);
|
|
36690
36690
|
diagnosticsChannel.subscribe(
|
|
36691
36691
|
"undici:request:error",
|
|
36692
36692
|
(evt) => {
|
|
36693
36693
|
const {
|
|
36694
|
-
request: { method, path:
|
|
36694
|
+
request: { method, path: path7, origin },
|
|
36695
36695
|
error
|
|
36696
36696
|
} = evt;
|
|
36697
36697
|
debugLog(
|
|
36698
36698
|
"request to %s %s%s errored - %s",
|
|
36699
36699
|
method,
|
|
36700
36700
|
origin,
|
|
36701
|
-
|
|
36701
|
+
path7,
|
|
36702
36702
|
error.message
|
|
36703
36703
|
);
|
|
36704
36704
|
}
|
|
@@ -36793,7 +36793,7 @@ var require_request3 = __commonJS({
|
|
|
36793
36793
|
var kHandler = Symbol("handler");
|
|
36794
36794
|
var Request = class {
|
|
36795
36795
|
constructor(origin, {
|
|
36796
|
-
path:
|
|
36796
|
+
path: path7,
|
|
36797
36797
|
method,
|
|
36798
36798
|
body,
|
|
36799
36799
|
headers,
|
|
@@ -36808,11 +36808,11 @@ var require_request3 = __commonJS({
|
|
|
36808
36808
|
servername,
|
|
36809
36809
|
throwOnError
|
|
36810
36810
|
}, handler) {
|
|
36811
|
-
if (typeof
|
|
36811
|
+
if (typeof path7 !== "string") {
|
|
36812
36812
|
throw new InvalidArgumentError("path must be a string");
|
|
36813
|
-
} else if (
|
|
36813
|
+
} else if (path7[0] !== "/" && !(path7.startsWith("http://") || path7.startsWith("https://")) && method !== "CONNECT") {
|
|
36814
36814
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
|
36815
|
-
} else if (invalidPathRegex.test(
|
|
36815
|
+
} else if (invalidPathRegex.test(path7)) {
|
|
36816
36816
|
throw new InvalidArgumentError("invalid request path");
|
|
36817
36817
|
}
|
|
36818
36818
|
if (typeof method !== "string") {
|
|
@@ -36877,7 +36877,7 @@ var require_request3 = __commonJS({
|
|
|
36877
36877
|
this.completed = false;
|
|
36878
36878
|
this.aborted = false;
|
|
36879
36879
|
this.upgrade = upgrade || null;
|
|
36880
|
-
this.path = query ? serializePathWithQuery(
|
|
36880
|
+
this.path = query ? serializePathWithQuery(path7, query) : path7;
|
|
36881
36881
|
this.origin = origin;
|
|
36882
36882
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
36883
36883
|
this.blocking = blocking ?? this.method !== "HEAD";
|
|
@@ -41654,7 +41654,7 @@ var require_client_h1 = __commonJS({
|
|
|
41654
41654
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
41655
41655
|
}
|
|
41656
41656
|
function writeH1(client, request) {
|
|
41657
|
-
const { method, path:
|
|
41657
|
+
const { method, path: path7, host, upgrade, blocking, reset } = request;
|
|
41658
41658
|
let { body, headers, contentLength } = request;
|
|
41659
41659
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
41660
41660
|
if (util.isFormDataLike(body)) {
|
|
@@ -41720,7 +41720,7 @@ var require_client_h1 = __commonJS({
|
|
|
41720
41720
|
if (blocking) {
|
|
41721
41721
|
socket[kBlocking] = true;
|
|
41722
41722
|
}
|
|
41723
|
-
let header = `${method} ${
|
|
41723
|
+
let header = `${method} ${path7} HTTP/1.1\r
|
|
41724
41724
|
`;
|
|
41725
41725
|
if (typeof host === "string") {
|
|
41726
41726
|
header += `host: ${host}\r
|
|
@@ -42277,7 +42277,7 @@ var require_client_h2 = __commonJS({
|
|
|
42277
42277
|
function writeH2(client, request) {
|
|
42278
42278
|
const requestTimeout = request.bodyTimeout ?? client[kBodyTimeout];
|
|
42279
42279
|
const session = client[kHTTP2Session];
|
|
42280
|
-
const { method, path:
|
|
42280
|
+
const { method, path: path7, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
|
|
42281
42281
|
let { body } = request;
|
|
42282
42282
|
if (upgrade) {
|
|
42283
42283
|
util.errorRequest(client, request, new Error("Upgrade not supported for H2"));
|
|
@@ -42348,7 +42348,7 @@ var require_client_h2 = __commonJS({
|
|
|
42348
42348
|
stream.setTimeout(requestTimeout);
|
|
42349
42349
|
return true;
|
|
42350
42350
|
}
|
|
42351
|
-
headers[HTTP2_HEADER_PATH] =
|
|
42351
|
+
headers[HTTP2_HEADER_PATH] = path7;
|
|
42352
42352
|
headers[HTTP2_HEADER_SCHEME] = "https";
|
|
42353
42353
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
42354
42354
|
if (body && typeof body.read === "function") {
|
|
@@ -45875,20 +45875,20 @@ var require_mock_utils = __commonJS({
|
|
|
45875
45875
|
}
|
|
45876
45876
|
return normalizedQp;
|
|
45877
45877
|
}
|
|
45878
|
-
function safeUrl(
|
|
45879
|
-
if (typeof
|
|
45880
|
-
return
|
|
45878
|
+
function safeUrl(path7) {
|
|
45879
|
+
if (typeof path7 !== "string") {
|
|
45880
|
+
return path7;
|
|
45881
45881
|
}
|
|
45882
|
-
const pathSegments =
|
|
45882
|
+
const pathSegments = path7.split("?", 3);
|
|
45883
45883
|
if (pathSegments.length !== 2) {
|
|
45884
|
-
return
|
|
45884
|
+
return path7;
|
|
45885
45885
|
}
|
|
45886
45886
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
45887
45887
|
qp.sort();
|
|
45888
45888
|
return [...pathSegments, qp.toString()].join("?");
|
|
45889
45889
|
}
|
|
45890
|
-
function matchKey(mockDispatch2, { path:
|
|
45891
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
45890
|
+
function matchKey(mockDispatch2, { path: path7, method, body, headers }) {
|
|
45891
|
+
const pathMatch = matchValue(mockDispatch2.path, path7);
|
|
45892
45892
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
45893
45893
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
45894
45894
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -45913,8 +45913,8 @@ var require_mock_utils = __commonJS({
|
|
|
45913
45913
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
45914
45914
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
45915
45915
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
45916
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
45917
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
45916
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path7, ignoreTrailingSlash }) => {
|
|
45917
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path7)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path7), resolvedPath);
|
|
45918
45918
|
});
|
|
45919
45919
|
if (matchedMockDispatches.length === 0) {
|
|
45920
45920
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -45952,19 +45952,19 @@ var require_mock_utils = __commonJS({
|
|
|
45952
45952
|
mockDispatches.splice(index, 1);
|
|
45953
45953
|
}
|
|
45954
45954
|
}
|
|
45955
|
-
function removeTrailingSlash(
|
|
45956
|
-
while (
|
|
45957
|
-
|
|
45955
|
+
function removeTrailingSlash(path7) {
|
|
45956
|
+
while (path7.endsWith("/")) {
|
|
45957
|
+
path7 = path7.slice(0, -1);
|
|
45958
45958
|
}
|
|
45959
|
-
if (
|
|
45960
|
-
|
|
45959
|
+
if (path7.length === 0) {
|
|
45960
|
+
path7 = "/";
|
|
45961
45961
|
}
|
|
45962
|
-
return
|
|
45962
|
+
return path7;
|
|
45963
45963
|
}
|
|
45964
45964
|
function buildKey(opts) {
|
|
45965
|
-
const { path:
|
|
45965
|
+
const { path: path7, method, body, headers, query } = opts;
|
|
45966
45966
|
return {
|
|
45967
|
-
path:
|
|
45967
|
+
path: path7,
|
|
45968
45968
|
method,
|
|
45969
45969
|
body,
|
|
45970
45970
|
headers,
|
|
@@ -46621,10 +46621,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
46621
46621
|
}
|
|
46622
46622
|
format(pendingInterceptors) {
|
|
46623
46623
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
46624
|
-
({ method, path:
|
|
46624
|
+
({ method, path: path7, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
46625
46625
|
Method: method,
|
|
46626
46626
|
Origin: origin,
|
|
46627
|
-
Path:
|
|
46627
|
+
Path: path7,
|
|
46628
46628
|
"Status code": statusCode,
|
|
46629
46629
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
46630
46630
|
Invocations: timesInvoked,
|
|
@@ -46701,9 +46701,9 @@ var require_mock_agent = __commonJS({
|
|
|
46701
46701
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
46702
46702
|
const dispatchOpts = { ...opts };
|
|
46703
46703
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
46704
|
-
const [
|
|
46704
|
+
const [path7, searchParams] = dispatchOpts.path.split("?");
|
|
46705
46705
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
46706
|
-
dispatchOpts.path = `${
|
|
46706
|
+
dispatchOpts.path = `${path7}?${normalizedSearchParams}`;
|
|
46707
46707
|
}
|
|
46708
46708
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
46709
46709
|
}
|
|
@@ -46997,9 +46997,9 @@ var require_redirect_handler = __commonJS({
|
|
|
46997
46997
|
return;
|
|
46998
46998
|
}
|
|
46999
46999
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
47000
|
-
const
|
|
47000
|
+
const path7 = search ? `${pathname}${search}` : pathname;
|
|
47001
47001
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
47002
|
-
this.opts.path =
|
|
47002
|
+
this.opts.path = path7;
|
|
47003
47003
|
this.opts.origin = origin;
|
|
47004
47004
|
this.opts.maxRedirections = 0;
|
|
47005
47005
|
this.opts.query = null;
|
|
@@ -52683,9 +52683,9 @@ var require_util7 = __commonJS({
|
|
|
52683
52683
|
}
|
|
52684
52684
|
}
|
|
52685
52685
|
}
|
|
52686
|
-
function validateCookiePath(
|
|
52687
|
-
for (let i = 0; i <
|
|
52688
|
-
const code =
|
|
52686
|
+
function validateCookiePath(path7) {
|
|
52687
|
+
for (let i = 0; i < path7.length; ++i) {
|
|
52688
|
+
const code = path7.charCodeAt(i);
|
|
52689
52689
|
if (code < 32 || // exclude CTLs (0-31)
|
|
52690
52690
|
code === 127 || // DEL
|
|
52691
52691
|
code === 59) {
|
|
@@ -55725,11 +55725,11 @@ var require_undici = __commonJS({
|
|
|
55725
55725
|
if (typeof opts.path !== "string") {
|
|
55726
55726
|
throw new InvalidArgumentError("invalid opts.path");
|
|
55727
55727
|
}
|
|
55728
|
-
let
|
|
55728
|
+
let path7 = opts.path;
|
|
55729
55729
|
if (!opts.path.startsWith("/")) {
|
|
55730
|
-
|
|
55730
|
+
path7 = `/${path7}`;
|
|
55731
55731
|
}
|
|
55732
|
-
url = new URL(util.parseOrigin(url).origin +
|
|
55732
|
+
url = new URL(util.parseOrigin(url).origin + path7);
|
|
55733
55733
|
} else {
|
|
55734
55734
|
if (!opts) {
|
|
55735
55735
|
opts = typeof url === "object" ? url : {};
|
|
@@ -56765,11 +56765,11 @@ var require_commonjs3 = __commonJS({
|
|
|
56765
56765
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
56766
56766
|
};
|
|
56767
56767
|
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
56768
|
-
var
|
|
56768
|
+
var path7 = {
|
|
56769
56769
|
win32: { sep: "\\" },
|
|
56770
56770
|
posix: { sep: "/" }
|
|
56771
56771
|
};
|
|
56772
|
-
exports2.sep = defaultPlatform === "win32" ?
|
|
56772
|
+
exports2.sep = defaultPlatform === "win32" ? path7.win32.sep : path7.posix.sep;
|
|
56773
56773
|
exports2.minimatch.sep = exports2.sep;
|
|
56774
56774
|
exports2.GLOBSTAR = Symbol("globstar **");
|
|
56775
56775
|
exports2.minimatch.GLOBSTAR = exports2.GLOBSTAR;
|
|
@@ -60037,12 +60037,12 @@ var require_commonjs6 = __commonJS({
|
|
|
60037
60037
|
/**
|
|
60038
60038
|
* Get the Path object referenced by the string path, resolved from this Path
|
|
60039
60039
|
*/
|
|
60040
|
-
resolve(
|
|
60041
|
-
if (!
|
|
60040
|
+
resolve(path7) {
|
|
60041
|
+
if (!path7) {
|
|
60042
60042
|
return this;
|
|
60043
60043
|
}
|
|
60044
|
-
const rootPath = this.getRootString(
|
|
60045
|
-
const dir =
|
|
60044
|
+
const rootPath = this.getRootString(path7);
|
|
60045
|
+
const dir = path7.substring(rootPath.length);
|
|
60046
60046
|
const dirParts = dir.split(this.splitSep);
|
|
60047
60047
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
60048
60048
|
return result;
|
|
@@ -60795,8 +60795,8 @@ var require_commonjs6 = __commonJS({
|
|
|
60795
60795
|
/**
|
|
60796
60796
|
* @internal
|
|
60797
60797
|
*/
|
|
60798
|
-
getRootString(
|
|
60799
|
-
return node_path_1.win32.parse(
|
|
60798
|
+
getRootString(path7) {
|
|
60799
|
+
return node_path_1.win32.parse(path7).root;
|
|
60800
60800
|
}
|
|
60801
60801
|
/**
|
|
60802
60802
|
* @internal
|
|
@@ -60843,8 +60843,8 @@ var require_commonjs6 = __commonJS({
|
|
|
60843
60843
|
/**
|
|
60844
60844
|
* @internal
|
|
60845
60845
|
*/
|
|
60846
|
-
getRootString(
|
|
60847
|
-
return
|
|
60846
|
+
getRootString(path7) {
|
|
60847
|
+
return path7.startsWith("/") ? "/" : "";
|
|
60848
60848
|
}
|
|
60849
60849
|
/**
|
|
60850
60850
|
* @internal
|
|
@@ -60894,8 +60894,8 @@ var require_commonjs6 = __commonJS({
|
|
|
60894
60894
|
*
|
|
60895
60895
|
* @internal
|
|
60896
60896
|
*/
|
|
60897
|
-
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
60898
|
-
this.#fs = fsFromOption(
|
|
60897
|
+
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs7 = defaultFS } = {}) {
|
|
60898
|
+
this.#fs = fsFromOption(fs7);
|
|
60899
60899
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
60900
60900
|
cwd = (0, node_url_1.fileURLToPath)(cwd);
|
|
60901
60901
|
}
|
|
@@ -60934,11 +60934,11 @@ var require_commonjs6 = __commonJS({
|
|
|
60934
60934
|
/**
|
|
60935
60935
|
* Get the depth of a provided path, string, or the cwd
|
|
60936
60936
|
*/
|
|
60937
|
-
depth(
|
|
60938
|
-
if (typeof
|
|
60939
|
-
|
|
60937
|
+
depth(path7 = this.cwd) {
|
|
60938
|
+
if (typeof path7 === "string") {
|
|
60939
|
+
path7 = this.cwd.resolve(path7);
|
|
60940
60940
|
}
|
|
60941
|
-
return
|
|
60941
|
+
return path7.depth();
|
|
60942
60942
|
}
|
|
60943
60943
|
/**
|
|
60944
60944
|
* Return the cache of child entries. Exposed so subclasses can create
|
|
@@ -61425,9 +61425,9 @@ var require_commonjs6 = __commonJS({
|
|
|
61425
61425
|
process2();
|
|
61426
61426
|
return results;
|
|
61427
61427
|
}
|
|
61428
|
-
chdir(
|
|
61428
|
+
chdir(path7 = this.cwd) {
|
|
61429
61429
|
const oldCwd = this.cwd;
|
|
61430
|
-
this.cwd = typeof
|
|
61430
|
+
this.cwd = typeof path7 === "string" ? this.cwd.resolve(path7) : path7;
|
|
61431
61431
|
this.cwd[setAsCwd](oldCwd);
|
|
61432
61432
|
}
|
|
61433
61433
|
};
|
|
@@ -61454,8 +61454,8 @@ var require_commonjs6 = __commonJS({
|
|
|
61454
61454
|
/**
|
|
61455
61455
|
* @internal
|
|
61456
61456
|
*/
|
|
61457
|
-
newRoot(
|
|
61458
|
-
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
61457
|
+
newRoot(fs7) {
|
|
61458
|
+
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs7 });
|
|
61459
61459
|
}
|
|
61460
61460
|
/**
|
|
61461
61461
|
* Return true if the provided path string is an absolute path
|
|
@@ -61484,8 +61484,8 @@ var require_commonjs6 = __commonJS({
|
|
|
61484
61484
|
/**
|
|
61485
61485
|
* @internal
|
|
61486
61486
|
*/
|
|
61487
|
-
newRoot(
|
|
61488
|
-
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
61487
|
+
newRoot(fs7) {
|
|
61488
|
+
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs7 });
|
|
61489
61489
|
}
|
|
61490
61490
|
/**
|
|
61491
61491
|
* Return true if the provided path string is an absolute path
|
|
@@ -61815,8 +61815,8 @@ var require_processor = __commonJS({
|
|
|
61815
61815
|
}
|
|
61816
61816
|
// match, absolute, ifdir
|
|
61817
61817
|
entries() {
|
|
61818
|
-
return [...this.store.entries()].map(([
|
|
61819
|
-
|
|
61818
|
+
return [...this.store.entries()].map(([path7, n]) => [
|
|
61819
|
+
path7,
|
|
61820
61820
|
!!(n & 2),
|
|
61821
61821
|
!!(n & 1)
|
|
61822
61822
|
]);
|
|
@@ -62034,9 +62034,9 @@ var require_walker = __commonJS({
|
|
|
62034
62034
|
signal;
|
|
62035
62035
|
maxDepth;
|
|
62036
62036
|
includeChildMatches;
|
|
62037
|
-
constructor(patterns,
|
|
62037
|
+
constructor(patterns, path7, opts) {
|
|
62038
62038
|
this.patterns = patterns;
|
|
62039
|
-
this.path =
|
|
62039
|
+
this.path = path7;
|
|
62040
62040
|
this.opts = opts;
|
|
62041
62041
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
62042
62042
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -62055,11 +62055,11 @@ var require_walker = __commonJS({
|
|
|
62055
62055
|
});
|
|
62056
62056
|
}
|
|
62057
62057
|
}
|
|
62058
|
-
#ignored(
|
|
62059
|
-
return this.seen.has(
|
|
62058
|
+
#ignored(path7) {
|
|
62059
|
+
return this.seen.has(path7) || !!this.#ignore?.ignored?.(path7);
|
|
62060
62060
|
}
|
|
62061
|
-
#childrenIgnored(
|
|
62062
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
62061
|
+
#childrenIgnored(path7) {
|
|
62062
|
+
return !!this.#ignore?.childrenIgnored?.(path7);
|
|
62063
62063
|
}
|
|
62064
62064
|
// backpressure mechanism
|
|
62065
62065
|
pause() {
|
|
@@ -62275,8 +62275,8 @@ var require_walker = __commonJS({
|
|
|
62275
62275
|
exports2.GlobUtil = GlobUtil;
|
|
62276
62276
|
var GlobWalker = class extends GlobUtil {
|
|
62277
62277
|
matches = /* @__PURE__ */ new Set();
|
|
62278
|
-
constructor(patterns,
|
|
62279
|
-
super(patterns,
|
|
62278
|
+
constructor(patterns, path7, opts) {
|
|
62279
|
+
super(patterns, path7, opts);
|
|
62280
62280
|
}
|
|
62281
62281
|
matchEmit(e) {
|
|
62282
62282
|
this.matches.add(e);
|
|
@@ -62314,8 +62314,8 @@ var require_walker = __commonJS({
|
|
|
62314
62314
|
exports2.GlobWalker = GlobWalker;
|
|
62315
62315
|
var GlobStream = class extends GlobUtil {
|
|
62316
62316
|
results;
|
|
62317
|
-
constructor(patterns,
|
|
62318
|
-
super(patterns,
|
|
62317
|
+
constructor(patterns, path7, opts) {
|
|
62318
|
+
super(patterns, path7, opts);
|
|
62319
62319
|
this.results = new minipass_1.Minipass({
|
|
62320
62320
|
signal: this.signal,
|
|
62321
62321
|
objectMode: true
|
|
@@ -62717,11 +62717,11 @@ var require_Mime = __commonJS({
|
|
|
62717
62717
|
}
|
|
62718
62718
|
}
|
|
62719
62719
|
};
|
|
62720
|
-
Mime.prototype.getType = function(
|
|
62721
|
-
|
|
62722
|
-
let last =
|
|
62720
|
+
Mime.prototype.getType = function(path7) {
|
|
62721
|
+
path7 = String(path7);
|
|
62722
|
+
let last = path7.replace(/^.*[/\\]/, "").toLowerCase();
|
|
62723
62723
|
let ext = last.replace(/^.*\./, "").toLowerCase();
|
|
62724
|
-
let hasPath = last.length <
|
|
62724
|
+
let hasPath = last.length < path7.length;
|
|
62725
62725
|
let hasDot = ext.length < last.length - 1;
|
|
62726
62726
|
return (hasDot || !hasPath) && this._types[ext] || null;
|
|
62727
62727
|
};
|
|
@@ -63750,8 +63750,8 @@ var require_createHttpError = __commonJS({
|
|
|
63750
63750
|
var require_send = __commonJS({
|
|
63751
63751
|
"node_modules/.pnpm/@fastify+send@4.1.0/node_modules/@fastify/send/lib/send.js"(exports2, module2) {
|
|
63752
63752
|
"use strict";
|
|
63753
|
-
var
|
|
63754
|
-
var
|
|
63753
|
+
var fs7 = require("node:fs");
|
|
63754
|
+
var path7 = require("node:path");
|
|
63755
63755
|
var stream = require("node:stream");
|
|
63756
63756
|
var debug = require("node:util").debuglog("send");
|
|
63757
63757
|
var decode = require_fast_decode_uri_component();
|
|
@@ -63767,11 +63767,11 @@ var require_send = __commonJS({
|
|
|
63767
63767
|
var { parseBytesRange } = require_parseBytesRange();
|
|
63768
63768
|
var { parseTokenList } = require_parseTokenList();
|
|
63769
63769
|
var { createHttpError } = require_createHttpError();
|
|
63770
|
-
var extname =
|
|
63771
|
-
var join5 =
|
|
63772
|
-
var normalize =
|
|
63773
|
-
var resolve =
|
|
63774
|
-
var sep2 =
|
|
63770
|
+
var extname = path7.extname;
|
|
63771
|
+
var join5 = path7.join;
|
|
63772
|
+
var normalize = path7.normalize;
|
|
63773
|
+
var resolve = path7.resolve;
|
|
63774
|
+
var sep2 = path7.sep;
|
|
63775
63775
|
var Readable = stream.Readable;
|
|
63776
63776
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
63777
63777
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
@@ -63838,36 +63838,36 @@ var require_send = __commonJS({
|
|
|
63838
63838
|
};
|
|
63839
63839
|
}
|
|
63840
63840
|
function normalizePath(_path, root) {
|
|
63841
|
-
let
|
|
63842
|
-
if (
|
|
63841
|
+
let path8 = decode(_path);
|
|
63842
|
+
if (path8 == null) {
|
|
63843
63843
|
return { statusCode: 400 };
|
|
63844
63844
|
}
|
|
63845
|
-
if (~
|
|
63845
|
+
if (~path8.indexOf("\0")) {
|
|
63846
63846
|
return { statusCode: 400 };
|
|
63847
63847
|
}
|
|
63848
63848
|
let parts;
|
|
63849
63849
|
if (root !== null) {
|
|
63850
|
-
if (
|
|
63851
|
-
|
|
63850
|
+
if (path8) {
|
|
63851
|
+
path8 = normalize("." + sep2 + path8);
|
|
63852
63852
|
}
|
|
63853
|
-
if (UP_PATH_REGEXP.test(
|
|
63854
|
-
debug('malicious path "%s"',
|
|
63853
|
+
if (UP_PATH_REGEXP.test(path8)) {
|
|
63854
|
+
debug('malicious path "%s"', path8);
|
|
63855
63855
|
return { statusCode: 403 };
|
|
63856
63856
|
}
|
|
63857
|
-
parts =
|
|
63858
|
-
|
|
63857
|
+
parts = path8.split(sep2);
|
|
63858
|
+
path8 = normalize(join5(root, path8));
|
|
63859
63859
|
} else {
|
|
63860
|
-
if (UP_PATH_REGEXP.test(
|
|
63861
|
-
debug('malicious path "%s"',
|
|
63860
|
+
if (UP_PATH_REGEXP.test(path8)) {
|
|
63861
|
+
debug('malicious path "%s"', path8);
|
|
63862
63862
|
return { statusCode: 403 };
|
|
63863
63863
|
}
|
|
63864
|
-
parts = normalize(
|
|
63865
|
-
|
|
63864
|
+
parts = normalize(path8).split(sep2);
|
|
63865
|
+
path8 = resolve(path8);
|
|
63866
63866
|
}
|
|
63867
|
-
return { path:
|
|
63867
|
+
return { path: path8, parts };
|
|
63868
63868
|
}
|
|
63869
|
-
function hasTrailingSlash(
|
|
63870
|
-
return
|
|
63869
|
+
function hasTrailingSlash(path8) {
|
|
63870
|
+
return path8[path8.length - 1] === "/";
|
|
63871
63871
|
}
|
|
63872
63872
|
function isConditionalGET(request) {
|
|
63873
63873
|
return request.headers["if-match"] || request.headers["if-unmodified-since"] || request.headers["if-none-match"] || request.headers["if-modified-since"];
|
|
@@ -63957,9 +63957,9 @@ var require_send = __commonJS({
|
|
|
63957
63957
|
lastModified <= ifRangeTimestamp
|
|
63958
63958
|
);
|
|
63959
63959
|
}
|
|
63960
|
-
function tryStat(
|
|
63960
|
+
function tryStat(path8) {
|
|
63961
63961
|
return new Promise((resolve2) => {
|
|
63962
|
-
|
|
63962
|
+
fs7.stat(path8, function onstat(error, stat2) {
|
|
63963
63963
|
resolve2({ error, stat: stat2 });
|
|
63964
63964
|
});
|
|
63965
63965
|
});
|
|
@@ -63995,7 +63995,7 @@ var require_send = __commonJS({
|
|
|
63995
63995
|
return sendError(500, err);
|
|
63996
63996
|
}
|
|
63997
63997
|
}
|
|
63998
|
-
function sendNotModified(headers,
|
|
63998
|
+
function sendNotModified(headers, path8, stat2) {
|
|
63999
63999
|
debug("not modified");
|
|
64000
64000
|
delete headers["Content-Encoding"];
|
|
64001
64001
|
delete headers["Content-Language"];
|
|
@@ -64008,15 +64008,15 @@ var require_send = __commonJS({
|
|
|
64008
64008
|
stream: Readable.from(""),
|
|
64009
64009
|
// metadata
|
|
64010
64010
|
type: "file",
|
|
64011
|
-
metadata: { path:
|
|
64011
|
+
metadata: { path: path8, stat: stat2 }
|
|
64012
64012
|
};
|
|
64013
64013
|
}
|
|
64014
|
-
function sendFileDirectly(request,
|
|
64014
|
+
function sendFileDirectly(request, path8, stat2, options) {
|
|
64015
64015
|
let len = stat2.size;
|
|
64016
64016
|
let offset = options.start ?? 0;
|
|
64017
64017
|
let statusCode = 200;
|
|
64018
64018
|
const headers = {};
|
|
64019
|
-
debug('send "%s"',
|
|
64019
|
+
debug('send "%s"', path8);
|
|
64020
64020
|
if (options.acceptRanges) {
|
|
64021
64021
|
debug("accept ranges");
|
|
64022
64022
|
headers["Accept-Ranges"] = "bytes";
|
|
@@ -64040,7 +64040,7 @@ var require_send = __commonJS({
|
|
|
64040
64040
|
headers.ETag = etag;
|
|
64041
64041
|
}
|
|
64042
64042
|
if (options.contentType) {
|
|
64043
|
-
let type = mime.getType(
|
|
64043
|
+
let type = mime.getType(path8) || mime.default_type;
|
|
64044
64044
|
debug("content-type %s", type);
|
|
64045
64045
|
if (type && isUtf8MimeType(type)) {
|
|
64046
64046
|
type += "; charset=utf-8";
|
|
@@ -64054,7 +64054,7 @@ var require_send = __commonJS({
|
|
|
64054
64054
|
return sendError(412);
|
|
64055
64055
|
}
|
|
64056
64056
|
if (isNotModifiedFailure(request, headers)) {
|
|
64057
|
-
return sendNotModified(headers,
|
|
64057
|
+
return sendNotModified(headers, path8, stat2);
|
|
64058
64058
|
}
|
|
64059
64059
|
}
|
|
64060
64060
|
len = Math.max(0, len - offset);
|
|
@@ -64096,10 +64096,10 @@ var require_send = __commonJS({
|
|
|
64096
64096
|
stream: Readable.from(""),
|
|
64097
64097
|
// metadata
|
|
64098
64098
|
type: "file",
|
|
64099
|
-
metadata: { path:
|
|
64099
|
+
metadata: { path: path8, stat: stat2 }
|
|
64100
64100
|
};
|
|
64101
64101
|
}
|
|
64102
|
-
const stream2 =
|
|
64102
|
+
const stream2 = fs7.createReadStream(path8, {
|
|
64103
64103
|
highWaterMark: options.highWaterMark,
|
|
64104
64104
|
start: offset,
|
|
64105
64105
|
end: Math.max(offset, offset + len - 1)
|
|
@@ -64110,10 +64110,10 @@ var require_send = __commonJS({
|
|
|
64110
64110
|
stream: stream2,
|
|
64111
64111
|
// metadata
|
|
64112
64112
|
type: "file",
|
|
64113
|
-
metadata: { path:
|
|
64113
|
+
metadata: { path: path8, stat: stat2 }
|
|
64114
64114
|
};
|
|
64115
64115
|
}
|
|
64116
|
-
function sendRedirect(
|
|
64116
|
+
function sendRedirect(path8, options) {
|
|
64117
64117
|
if (hasTrailingSlash(options.path)) {
|
|
64118
64118
|
return sendError(403);
|
|
64119
64119
|
}
|
|
@@ -64131,14 +64131,14 @@ var require_send = __commonJS({
|
|
|
64131
64131
|
stream: Readable.from(doc[0]),
|
|
64132
64132
|
// metadata
|
|
64133
64133
|
type: "directory",
|
|
64134
|
-
metadata: { requestPath: options.path, path:
|
|
64134
|
+
metadata: { requestPath: options.path, path: path8 }
|
|
64135
64135
|
};
|
|
64136
64136
|
}
|
|
64137
|
-
async function sendIndex(request,
|
|
64137
|
+
async function sendIndex(request, path8, options) {
|
|
64138
64138
|
let err;
|
|
64139
64139
|
for (let i = 0; i < options.index.length; i++) {
|
|
64140
64140
|
const index = options.index[i];
|
|
64141
|
-
const p = join5(
|
|
64141
|
+
const p = join5(path8, index);
|
|
64142
64142
|
const { error, stat: stat2 } = await tryStat(p);
|
|
64143
64143
|
if (error) {
|
|
64144
64144
|
err = error;
|
|
@@ -64152,13 +64152,13 @@ var require_send = __commonJS({
|
|
|
64152
64152
|
}
|
|
64153
64153
|
return sendError(404);
|
|
64154
64154
|
}
|
|
64155
|
-
async function sendFile(request,
|
|
64156
|
-
const { error, stat: stat2 } = await tryStat(
|
|
64157
|
-
if (error && error.code === "ENOENT" && !extname(
|
|
64155
|
+
async function sendFile(request, path8, options) {
|
|
64156
|
+
const { error, stat: stat2 } = await tryStat(path8);
|
|
64157
|
+
if (error && error.code === "ENOENT" && !extname(path8) && path8[path8.length - 1] !== sep2) {
|
|
64158
64158
|
let err = error;
|
|
64159
64159
|
for (let i = 0; i < options.extensions.length; i++) {
|
|
64160
64160
|
const extension = options.extensions[i];
|
|
64161
|
-
const p =
|
|
64161
|
+
const p = path8 + "." + extension;
|
|
64162
64162
|
const { error: error2, stat: stat3 } = await tryStat(p);
|
|
64163
64163
|
if (error2) {
|
|
64164
64164
|
err = error2;
|
|
@@ -64176,14 +64176,14 @@ var require_send = __commonJS({
|
|
|
64176
64176
|
return sendError(404);
|
|
64177
64177
|
}
|
|
64178
64178
|
if (error) return sendStatError(error);
|
|
64179
|
-
if (stat2.isDirectory()) return sendRedirect(
|
|
64180
|
-
return sendFileDirectly(request,
|
|
64179
|
+
if (stat2.isDirectory()) return sendRedirect(path8, options);
|
|
64180
|
+
return sendFileDirectly(request, path8, stat2, options);
|
|
64181
64181
|
}
|
|
64182
64182
|
async function send(request, _path, options) {
|
|
64183
64183
|
const opts = normalizeOptions(options);
|
|
64184
64184
|
opts.path = _path;
|
|
64185
64185
|
const parsed = normalizePath(_path, opts.root);
|
|
64186
|
-
const { path:
|
|
64186
|
+
const { path: path8, parts } = parsed;
|
|
64187
64187
|
if (parsed.statusCode !== void 0) {
|
|
64188
64188
|
return sendError(parsed.statusCode);
|
|
64189
64189
|
}
|
|
@@ -64193,23 +64193,23 @@ var require_send = __commonJS({
|
|
|
64193
64193
|
/* c8 ignore start */
|
|
64194
64194
|
/* unreachable, because NODE_DEBUG can not be set after process is running */
|
|
64195
64195
|
case 0:
|
|
64196
|
-
debug('allow dotfile "%s"',
|
|
64196
|
+
debug('allow dotfile "%s"', path8);
|
|
64197
64197
|
break;
|
|
64198
64198
|
/* c8 ignore stop */
|
|
64199
64199
|
case 2:
|
|
64200
|
-
debug('deny dotfile "%s"',
|
|
64200
|
+
debug('deny dotfile "%s"', path8);
|
|
64201
64201
|
return sendError(403);
|
|
64202
64202
|
case 1:
|
|
64203
64203
|
// 'ignore'
|
|
64204
64204
|
default:
|
|
64205
|
-
debug('ignore dotfile "%s"',
|
|
64205
|
+
debug('ignore dotfile "%s"', path8);
|
|
64206
64206
|
return sendError(404);
|
|
64207
64207
|
}
|
|
64208
64208
|
}
|
|
64209
64209
|
if (opts.index.length && hasTrailingSlash(_path)) {
|
|
64210
|
-
return sendIndex(request,
|
|
64210
|
+
return sendIndex(request, path8, opts);
|
|
64211
64211
|
}
|
|
64212
|
-
return sendFile(request,
|
|
64212
|
+
return sendFile(request, path8, opts);
|
|
64213
64213
|
}
|
|
64214
64214
|
module2.exports.send = send;
|
|
64215
64215
|
}
|
|
@@ -64596,30 +64596,30 @@ var require_dirList = __commonJS({
|
|
|
64596
64596
|
"node_modules/.pnpm/@fastify+static@8.2.0/node_modules/@fastify/static/lib/dirList.js"(exports2, module2) {
|
|
64597
64597
|
"use strict";
|
|
64598
64598
|
var os2 = require("node:os");
|
|
64599
|
-
var
|
|
64600
|
-
var
|
|
64599
|
+
var path7 = require("node:path");
|
|
64600
|
+
var fs7 = require("node:fs/promises");
|
|
64601
64601
|
var fastq = require_queue();
|
|
64602
64602
|
var fastqConcurrency = Math.max(1, os2.cpus().length - 1);
|
|
64603
64603
|
var dirList = {
|
|
64604
64604
|
_getExtendedInfo: async function(dir, info) {
|
|
64605
|
-
const depth = dir.split(
|
|
64606
|
-
const files = await
|
|
64605
|
+
const depth = dir.split(path7.sep).length;
|
|
64606
|
+
const files = await fs7.readdir(dir);
|
|
64607
64607
|
const worker = async (filename) => {
|
|
64608
|
-
const filePath =
|
|
64608
|
+
const filePath = path7.join(dir, filename);
|
|
64609
64609
|
let stats;
|
|
64610
64610
|
try {
|
|
64611
|
-
stats = await
|
|
64611
|
+
stats = await fs7.stat(filePath);
|
|
64612
64612
|
} catch {
|
|
64613
64613
|
return;
|
|
64614
64614
|
}
|
|
64615
64615
|
if (stats.isDirectory()) {
|
|
64616
64616
|
info.totalFolderCount++;
|
|
64617
|
-
filePath.split(
|
|
64617
|
+
filePath.split(path7.sep).length === depth + 1 && info.folderCount++;
|
|
64618
64618
|
await dirList._getExtendedInfo(filePath, info);
|
|
64619
64619
|
} else {
|
|
64620
64620
|
info.totalSize += stats.size;
|
|
64621
64621
|
info.totalFileCount++;
|
|
64622
|
-
filePath.split(
|
|
64622
|
+
filePath.split(path7.sep).length === depth + 1 && info.fileCount++;
|
|
64623
64623
|
info.lastModified = Math.max(info.lastModified, stats.mtimeMs);
|
|
64624
64624
|
}
|
|
64625
64625
|
};
|
|
@@ -64652,7 +64652,7 @@ var require_dirList = __commonJS({
|
|
|
64652
64652
|
*/
|
|
64653
64653
|
list: async function(dir, options, dotfiles) {
|
|
64654
64654
|
const entries = { dirs: [], files: [] };
|
|
64655
|
-
let files = await
|
|
64655
|
+
let files = await fs7.readdir(dir);
|
|
64656
64656
|
if (dotfiles === "deny" || dotfiles === "ignore") {
|
|
64657
64657
|
files = files.filter((file) => file.charAt(0) !== ".");
|
|
64658
64658
|
}
|
|
@@ -64662,14 +64662,14 @@ var require_dirList = __commonJS({
|
|
|
64662
64662
|
const worker = async (filename) => {
|
|
64663
64663
|
let stats;
|
|
64664
64664
|
try {
|
|
64665
|
-
stats = await
|
|
64665
|
+
stats = await fs7.stat(path7.join(dir, filename));
|
|
64666
64666
|
} catch {
|
|
64667
64667
|
return;
|
|
64668
64668
|
}
|
|
64669
64669
|
const entry = { name: filename, stats };
|
|
64670
64670
|
if (stats.isDirectory()) {
|
|
64671
64671
|
if (options.extendedFolderInfo) {
|
|
64672
|
-
entry.extendedInfo = await dirList.getExtendedInfo(
|
|
64672
|
+
entry.extendedInfo = await dirList.getExtendedInfo(path7.join(dir, filename));
|
|
64673
64673
|
}
|
|
64674
64674
|
entries.dirs.push(entry);
|
|
64675
64675
|
} else {
|
|
@@ -64725,11 +64725,11 @@ var require_dirList = __commonJS({
|
|
|
64725
64725
|
* @return {ListFile}
|
|
64726
64726
|
*/
|
|
64727
64727
|
htmlInfo: function(entry, route, prefix, options) {
|
|
64728
|
-
if (options.names?.includes(
|
|
64729
|
-
route =
|
|
64728
|
+
if (options.names?.includes(path7.basename(route))) {
|
|
64729
|
+
route = path7.normalize(path7.join(route, ".."));
|
|
64730
64730
|
}
|
|
64731
64731
|
return {
|
|
64732
|
-
href: encodeURI(
|
|
64732
|
+
href: encodeURI(path7.join(prefix, route, entry.name).replace(/\\/gu, "/")),
|
|
64733
64733
|
name: entry.name,
|
|
64734
64734
|
stats: entry.stats,
|
|
64735
64735
|
extendedInfo: entry.extendedInfo
|
|
@@ -64742,7 +64742,7 @@ var require_dirList = __commonJS({
|
|
|
64742
64742
|
* @return {boolean}
|
|
64743
64743
|
*/
|
|
64744
64744
|
handle: function(route, options) {
|
|
64745
|
-
return options.names?.includes(
|
|
64745
|
+
return options.names?.includes(path7.basename(route)) || // match trailing slash
|
|
64746
64746
|
((options.names?.includes("/") && route[route.length - 1] === "/") ?? false);
|
|
64747
64747
|
},
|
|
64748
64748
|
/**
|
|
@@ -64752,7 +64752,7 @@ var require_dirList = __commonJS({
|
|
|
64752
64752
|
*/
|
|
64753
64753
|
path: function(root, route) {
|
|
64754
64754
|
const _route = route[route.length - 1] === "/" ? route + "none" : route;
|
|
64755
|
-
return
|
|
64755
|
+
return path7.dirname(path7.join(root, _route));
|
|
64756
64756
|
},
|
|
64757
64757
|
/**
|
|
64758
64758
|
* validate options
|
|
@@ -64787,7 +64787,7 @@ var require_dirList = __commonJS({
|
|
|
64787
64787
|
var require_static = __commonJS({
|
|
64788
64788
|
"node_modules/.pnpm/@fastify+static@8.2.0/node_modules/@fastify/static/index.js"(exports2, module2) {
|
|
64789
64789
|
"use strict";
|
|
64790
|
-
var
|
|
64790
|
+
var path7 = require("node:path");
|
|
64791
64791
|
var { fileURLToPath } = require("node:url");
|
|
64792
64792
|
var { statSync } = require("node:fs");
|
|
64793
64793
|
var { glob } = require_commonjs7();
|
|
@@ -64894,7 +64894,7 @@ var require_static = __commonJS({
|
|
|
64894
64894
|
const routes = /* @__PURE__ */ new Set();
|
|
64895
64895
|
const roots = Array.isArray(sendOptions.root) ? sendOptions.root : [sendOptions.root];
|
|
64896
64896
|
for (let rootPath of roots) {
|
|
64897
|
-
rootPath = rootPath.split(
|
|
64897
|
+
rootPath = rootPath.split(path7.win32.sep).join(path7.posix.sep);
|
|
64898
64898
|
!rootPath.endsWith("/") && (rootPath += "/");
|
|
64899
64899
|
const files = await glob("**/**", {
|
|
64900
64900
|
cwd: rootPath,
|
|
@@ -64905,16 +64905,16 @@ var require_static = __commonJS({
|
|
|
64905
64905
|
ignore: opts.globIgnore
|
|
64906
64906
|
});
|
|
64907
64907
|
for (let file of files) {
|
|
64908
|
-
file = file.split(
|
|
64908
|
+
file = file.split(path7.win32.sep).join(path7.posix.sep);
|
|
64909
64909
|
const route = prefix + file;
|
|
64910
64910
|
if (routes.has(route)) {
|
|
64911
64911
|
continue;
|
|
64912
64912
|
}
|
|
64913
64913
|
routes.add(route);
|
|
64914
64914
|
setUpHeadAndGet(routeOpts, route, `/${file}`, rootPath);
|
|
64915
|
-
const key =
|
|
64915
|
+
const key = path7.posix.basename(route);
|
|
64916
64916
|
if (indexes.includes(key) && !indexDirs.has(key)) {
|
|
64917
|
-
indexDirs.set(
|
|
64917
|
+
indexDirs.set(path7.posix.dirname(route), rootPath);
|
|
64918
64918
|
}
|
|
64919
64919
|
}
|
|
64920
64920
|
}
|
|
@@ -64970,11 +64970,11 @@ var require_static = __commonJS({
|
|
|
64970
64970
|
} = await send(request.raw, encodeURI(pathnameForSend), options);
|
|
64971
64971
|
switch (type) {
|
|
64972
64972
|
case "directory": {
|
|
64973
|
-
const
|
|
64973
|
+
const path8 = metadata.path;
|
|
64974
64974
|
if (opts.list) {
|
|
64975
64975
|
await dirList.send({
|
|
64976
64976
|
reply,
|
|
64977
|
-
dir:
|
|
64977
|
+
dir: path8,
|
|
64978
64978
|
options: opts.list,
|
|
64979
64979
|
route: pathname,
|
|
64980
64980
|
prefix,
|
|
@@ -65133,7 +65133,7 @@ var require_static = __commonJS({
|
|
|
65133
65133
|
'"root" option array contains one or more duplicate paths'
|
|
65134
65134
|
);
|
|
65135
65135
|
}
|
|
65136
|
-
rootPath.map((
|
|
65136
|
+
rootPath.map((path8) => checkPath(fastify, path8));
|
|
65137
65137
|
return;
|
|
65138
65138
|
}
|
|
65139
65139
|
if (typeof rootPath === "string") {
|
|
@@ -65145,7 +65145,7 @@ var require_static = __commonJS({
|
|
|
65145
65145
|
if (typeof rootPath !== "string") {
|
|
65146
65146
|
throw new TypeError('"root" option must be a string');
|
|
65147
65147
|
}
|
|
65148
|
-
if (
|
|
65148
|
+
if (path7.isAbsolute(rootPath) === false) {
|
|
65149
65149
|
throw new Error('"root" option must be an absolute path');
|
|
65150
65150
|
}
|
|
65151
65151
|
let pathStat;
|
|
@@ -65162,8 +65162,8 @@ var require_static = __commonJS({
|
|
|
65162
65162
|
throw new Error('"root" option must point to a directory');
|
|
65163
65163
|
}
|
|
65164
65164
|
}
|
|
65165
|
-
function getContentType(
|
|
65166
|
-
const type = send.mime.getType(
|
|
65165
|
+
function getContentType(path8) {
|
|
65166
|
+
const type = send.mime.getType(path8) || send.mime.default_type;
|
|
65167
65167
|
if (!send.isUtf8MimeType(type)) {
|
|
65168
65168
|
return type;
|
|
65169
65169
|
}
|
|
@@ -65172,7 +65172,7 @@ var require_static = __commonJS({
|
|
|
65172
65172
|
function findIndexFile(pathname, root, indexFiles = ["index.html"]) {
|
|
65173
65173
|
if (Array.isArray(indexFiles)) {
|
|
65174
65174
|
return indexFiles.find((filename) => {
|
|
65175
|
-
const p =
|
|
65175
|
+
const p = path7.join(root, pathname, filename);
|
|
65176
65176
|
try {
|
|
65177
65177
|
const stats = statSync(p);
|
|
65178
65178
|
return !stats.isDirectory();
|
|
@@ -65229,7 +65229,7 @@ var require_package3 = __commonJS({
|
|
|
65229
65229
|
"package.json"(exports2, module2) {
|
|
65230
65230
|
module2.exports = {
|
|
65231
65231
|
name: "@musistudio/claude-code-router",
|
|
65232
|
-
version: "1.0.
|
|
65232
|
+
version: "1.0.38",
|
|
65233
65233
|
description: "Use Claude Code without an Anthropics account and route it to another LLM provider",
|
|
65234
65234
|
bin: {
|
|
65235
65235
|
ccr: "./dist/cli.js"
|
|
@@ -65249,7 +65249,7 @@ var require_package3 = __commonJS({
|
|
|
65249
65249
|
license: "MIT",
|
|
65250
65250
|
dependencies: {
|
|
65251
65251
|
"@fastify/static": "^8.2.0",
|
|
65252
|
-
"@musistudio/llms": "^1.0.
|
|
65252
|
+
"@musistudio/llms": "^1.0.24",
|
|
65253
65253
|
dotenv: "^16.4.7",
|
|
65254
65254
|
json5: "^2.2.3",
|
|
65255
65255
|
openurl: "^1.1.1",
|
|
@@ -65669,13 +65669,13 @@ var require_tiktoken = __commonJS({
|
|
|
65669
65669
|
var wasm = require_tiktoken_bg();
|
|
65670
65670
|
var imports = {};
|
|
65671
65671
|
imports["./tiktoken_bg.js"] = wasm;
|
|
65672
|
-
var
|
|
65673
|
-
var
|
|
65674
|
-
var candidates = __dirname.split(
|
|
65675
|
-
const prefix = array.slice(0, index + 1).join(
|
|
65676
|
-
if (!prefix.includes("node_modules" +
|
|
65672
|
+
var path7 = require("path");
|
|
65673
|
+
var fs7 = require("fs");
|
|
65674
|
+
var candidates = __dirname.split(path7.sep).reduce((memo, _, index, array) => {
|
|
65675
|
+
const prefix = array.slice(0, index + 1).join(path7.sep) + path7.sep;
|
|
65676
|
+
if (!prefix.includes("node_modules" + path7.sep)) {
|
|
65677
65677
|
memo.unshift(
|
|
65678
|
-
|
|
65678
|
+
path7.join(
|
|
65679
65679
|
prefix,
|
|
65680
65680
|
"node_modules",
|
|
65681
65681
|
"tiktoken",
|
|
@@ -65686,11 +65686,11 @@ var require_tiktoken = __commonJS({
|
|
|
65686
65686
|
}
|
|
65687
65687
|
return memo;
|
|
65688
65688
|
}, []);
|
|
65689
|
-
candidates.unshift(
|
|
65689
|
+
candidates.unshift(path7.join(__dirname, "./tiktoken_bg.wasm"));
|
|
65690
65690
|
var bytes = null;
|
|
65691
65691
|
for (const candidate of candidates) {
|
|
65692
65692
|
try {
|
|
65693
|
-
bytes =
|
|
65693
|
+
bytes = fs7.readFileSync(candidate);
|
|
65694
65694
|
break;
|
|
65695
65695
|
} catch {
|
|
65696
65696
|
}
|
|
@@ -65712,7 +65712,7 @@ var import_os = require("os");
|
|
|
65712
65712
|
var import_path4 = require("path");
|
|
65713
65713
|
init_utils();
|
|
65714
65714
|
|
|
65715
|
-
// node_modules/.pnpm/@musistudio+llms@1.0.
|
|
65715
|
+
// node_modules/.pnpm/@musistudio+llms@1.0.24_ws@8.18.3_zod@3.25.67/node_modules/@musistudio/llms/dist/esm/server.mjs
|
|
65716
65716
|
var import_node_fs = require("node:fs");
|
|
65717
65717
|
var import_node_path4 = require("node:path");
|
|
65718
65718
|
var import_node_stream = __toESM(require("node:stream"), 1);
|
|
@@ -74739,7 +74739,7 @@ function Lf(r, e, t, n) {
|
|
|
74739
74739
|
let l = { method: "POST", headers: o, body: JSON.stringify(e), signal: a };
|
|
74740
74740
|
return t.httpsProxy && (l.dispatcher = new import_undici.ProxyAgent(new URL(t.httpsProxy).toString())), n?.debug({ request: l, headers: Object.fromEntries(o.entries()), requestUrl: typeof r == "string" ? r : r.toString(), useProxy: t.httpsProxy }, "final request"), fetch(typeof r == "string" ? r : r.toString(), l);
|
|
74741
74741
|
}
|
|
74742
|
-
var Uf = "1.0.
|
|
74742
|
+
var Uf = "1.0.24";
|
|
74743
74743
|
async function o0(r, e, t, n) {
|
|
74744
74744
|
let o = r.body, a = r.provider, u = t._server.providerService.getProvider(a);
|
|
74745
74745
|
if (!u) throw bt(`Provider '${a}' not found`, 404, "provider_not_found");
|
|
@@ -75104,14 +75104,7 @@ data: ${JSON.stringify(j)}
|
|
|
75104
75104
|
if (g || d) break;
|
|
75105
75105
|
if (!he.startsWith("data: ")) continue;
|
|
75106
75106
|
let le = he.slice(6);
|
|
75107
|
-
if (this.logger.debug(`recieved data: ${le}`), le
|
|
75108
|
-
u && (v(o.encode(`event: message_delta
|
|
75109
|
-
data: ${JSON.stringify(u)}
|
|
75110
|
-
|
|
75111
|
-
`)), u = null);
|
|
75112
|
-
continue;
|
|
75113
|
-
}
|
|
75114
|
-
try {
|
|
75107
|
+
if (this.logger.debug(`recieved data: ${le}`), le !== "[DONE]") try {
|
|
75115
75108
|
let ne = JSON.parse(le);
|
|
75116
75109
|
if (P++, this.logger.debug({ response: ne }, "Original Response"), ne.error) {
|
|
75117
75110
|
let oe = { type: "error", message: { type: "api_error", message: JSON.stringify(ne.error) } };
|
|
@@ -76843,8 +76836,16 @@ var LOG_FILE = import_node_path5.default.join(HOME_DIR, "claude-code-router.log"
|
|
|
76843
76836
|
if (!import_node_fs2.default.existsSync(HOME_DIR)) {
|
|
76844
76837
|
import_node_fs2.default.mkdirSync(HOME_DIR, { recursive: true });
|
|
76845
76838
|
}
|
|
76839
|
+
var isLogEnabled = null;
|
|
76840
|
+
var logLevel = "info";
|
|
76841
|
+
function configureLogging(config) {
|
|
76842
|
+
isLogEnabled = config.LOG !== false;
|
|
76843
|
+
logLevel = config.LOG_LEVEL || "info";
|
|
76844
|
+
}
|
|
76846
76845
|
function log2(...args) {
|
|
76847
|
-
|
|
76846
|
+
if (isLogEnabled === null) {
|
|
76847
|
+
isLogEnabled = true;
|
|
76848
|
+
}
|
|
76848
76849
|
if (!isLogEnabled) {
|
|
76849
76850
|
return;
|
|
76850
76851
|
}
|
|
@@ -77094,8 +77095,8 @@ function savePid(pid) {
|
|
|
77094
77095
|
function cleanupPidFile() {
|
|
77095
77096
|
if ((0, import_fs2.existsSync)(PID_FILE)) {
|
|
77096
77097
|
try {
|
|
77097
|
-
const
|
|
77098
|
-
|
|
77098
|
+
const fs7 = require("fs");
|
|
77099
|
+
fs7.unlinkSync(PID_FILE);
|
|
77099
77100
|
} catch (e) {
|
|
77100
77101
|
}
|
|
77101
77102
|
}
|
|
@@ -77172,11 +77173,11 @@ var RotatingFileStream = class extends import_stream.Writable {
|
|
|
77172
77173
|
timeout;
|
|
77173
77174
|
timeoutPromise;
|
|
77174
77175
|
constructor(generator, options) {
|
|
77175
|
-
const { encoding, history, maxFiles, maxSize, path:
|
|
77176
|
+
const { encoding, history, maxFiles, maxSize, path: path7 } = options;
|
|
77176
77177
|
super({ decodeStrings: true, defaultEncoding: encoding });
|
|
77177
77178
|
this.createGzip = import_zlib.createGzip;
|
|
77178
77179
|
this.exec = import_child_process2.exec;
|
|
77179
|
-
this.filename =
|
|
77180
|
+
this.filename = path7 + generator(null);
|
|
77180
77181
|
this.fsCreateReadStream = import_fs3.createReadStream;
|
|
77181
77182
|
this.fsCreateWriteStream = import_fs3.createWriteStream;
|
|
77182
77183
|
this.fsOpen = import_promises3.open;
|
|
@@ -77188,7 +77189,7 @@ var RotatingFileStream = class extends import_stream.Writable {
|
|
|
77188
77189
|
this.options = options;
|
|
77189
77190
|
this.stdout = process.stdout;
|
|
77190
77191
|
if (maxFiles || maxSize)
|
|
77191
|
-
options.history =
|
|
77192
|
+
options.history = path7 + (history ? history : this.generator(null) + ".txt");
|
|
77192
77193
|
this.on("close", () => this.finished ? null : this.emit("finish"));
|
|
77193
77194
|
this.on("finish", () => this.finished = this.clear());
|
|
77194
77195
|
(async () => {
|
|
@@ -77316,9 +77317,9 @@ var RotatingFileStream = class extends import_stream.Writable {
|
|
|
77316
77317
|
return this.move();
|
|
77317
77318
|
}
|
|
77318
77319
|
async findName() {
|
|
77319
|
-
const { interval, path:
|
|
77320
|
+
const { interval, path: path7, intervalBoundary } = this.options;
|
|
77320
77321
|
for (let index = 1; index < 1e3; ++index) {
|
|
77321
|
-
const filename =
|
|
77322
|
+
const filename = path7 + this.generator(interval && intervalBoundary ? new Date(this.prev) : this.rotation, index);
|
|
77322
77323
|
if (!await exists(filename))
|
|
77323
77324
|
return filename;
|
|
77324
77325
|
}
|
|
@@ -77348,11 +77349,11 @@ var RotatingFileStream = class extends import_stream.Writable {
|
|
|
77348
77349
|
return this.unlink(filename);
|
|
77349
77350
|
}
|
|
77350
77351
|
async classical() {
|
|
77351
|
-
const { compress, path:
|
|
77352
|
+
const { compress, path: path7, rotate } = this.options;
|
|
77352
77353
|
let rotatedName = "";
|
|
77353
77354
|
for (let count = rotate; count > 0; --count) {
|
|
77354
|
-
const currName =
|
|
77355
|
-
const prevName = count === 1 ? this.filename :
|
|
77355
|
+
const currName = path7 + this.generator(count);
|
|
77356
|
+
const prevName = count === 1 ? this.filename : path7 + this.generator(count - 1);
|
|
77356
77357
|
if (!await exists(prevName))
|
|
77357
77358
|
continue;
|
|
77358
77359
|
if (!rotatedName)
|
|
@@ -77729,7 +77730,7 @@ function createStream(filename, options) {
|
|
|
77729
77730
|
|
|
77730
77731
|
// node_modules/.pnpm/pino-rotating-file-stream@0.0.2/node_modules/pino-rotating-file-stream/dist/mjs/index.js
|
|
77731
77732
|
var mjs_default = (options) => {
|
|
77732
|
-
const { filename, size, maxSize, interval, compress, path:
|
|
77733
|
+
const { filename, size, maxSize, interval, compress, path: path7, ...otherOptions } = options;
|
|
77733
77734
|
return createStream(filename, {
|
|
77734
77735
|
...otherOptions,
|
|
77735
77736
|
// Set some default values
|
|
@@ -77737,7 +77738,7 @@ var mjs_default = (options) => {
|
|
|
77737
77738
|
maxSize: maxSize || "1G",
|
|
77738
77739
|
interval: interval || "7d",
|
|
77739
77740
|
compress: compress || "gzip",
|
|
77740
|
-
path:
|
|
77741
|
+
path: path7
|
|
77741
77742
|
});
|
|
77742
77743
|
};
|
|
77743
77744
|
|
|
@@ -77771,6 +77772,7 @@ async function run(options = {}) {
|
|
|
77771
77772
|
await initDir();
|
|
77772
77773
|
await cleanupLogFiles();
|
|
77773
77774
|
const config = await initConfig();
|
|
77775
|
+
configureLogging(config);
|
|
77774
77776
|
let HOST = config.HOST;
|
|
77775
77777
|
if (config.HOST && !config.APIKEY) {
|
|
77776
77778
|
HOST = "127.0.0.1";
|
|
@@ -77789,6 +77791,15 @@ async function run(options = {}) {
|
|
|
77789
77791
|
});
|
|
77790
77792
|
console.log(HOST);
|
|
77791
77793
|
const servicePort = process.env.SERVICE_PORT ? parseInt(process.env.SERVICE_PORT) : port;
|
|
77794
|
+
const loggerConfig = config.LOG !== false ? {
|
|
77795
|
+
level: config.LOG_LEVEL || "info",
|
|
77796
|
+
stream: mjs_default({
|
|
77797
|
+
path: HOME_DIR,
|
|
77798
|
+
filename: config.LOGNAME || `./logs/ccr-${+/* @__PURE__ */ new Date()}.log`,
|
|
77799
|
+
maxFiles: 3,
|
|
77800
|
+
interval: "1d"
|
|
77801
|
+
})
|
|
77802
|
+
} : false;
|
|
77792
77803
|
const server = createServer({
|
|
77793
77804
|
jsonPath: CONFIG_FILE,
|
|
77794
77805
|
initialConfig: {
|
|
@@ -77802,15 +77813,7 @@ async function run(options = {}) {
|
|
|
77802
77813
|
"claude-code-router.log"
|
|
77803
77814
|
)
|
|
77804
77815
|
},
|
|
77805
|
-
logger:
|
|
77806
|
-
level: "debug",
|
|
77807
|
-
stream: mjs_default({
|
|
77808
|
-
path: HOME_DIR,
|
|
77809
|
-
filename: config.LOGNAME || `./logs/ccr-${+/* @__PURE__ */ new Date()}.log`,
|
|
77810
|
-
maxFiles: 3,
|
|
77811
|
-
interval: "1d"
|
|
77812
|
-
})
|
|
77813
|
-
}
|
|
77816
|
+
logger: loggerConfig
|
|
77814
77817
|
});
|
|
77815
77818
|
server.addHook("preHandler", async (req, reply) => {
|
|
77816
77819
|
return new Promise((resolve, reject) => {
|
|
@@ -77931,9 +77934,513 @@ async function executeCodeCommand(args = []) {
|
|
|
77931
77934
|
});
|
|
77932
77935
|
}
|
|
77933
77936
|
|
|
77937
|
+
// src/utils/statusline.ts
|
|
77938
|
+
var import_promises5 = __toESM(require("node:fs/promises"));
|
|
77939
|
+
var import_child_process4 = require("child_process");
|
|
77940
|
+
var import_node_path6 = __toESM(require("node:path"));
|
|
77941
|
+
init_constants();
|
|
77942
|
+
var import_json52 = __toESM(require_lib());
|
|
77943
|
+
var COLORS = {
|
|
77944
|
+
reset: "\x1B[0m",
|
|
77945
|
+
bold: "\x1B[1m",
|
|
77946
|
+
dim: "\x1B[2m",
|
|
77947
|
+
// 标准颜色
|
|
77948
|
+
black: "\x1B[30m",
|
|
77949
|
+
red: "\x1B[31m",
|
|
77950
|
+
green: "\x1B[32m",
|
|
77951
|
+
yellow: "\x1B[33m",
|
|
77952
|
+
blue: "\x1B[34m",
|
|
77953
|
+
magenta: "\x1B[35m",
|
|
77954
|
+
cyan: "\x1B[36m",
|
|
77955
|
+
white: "\x1B[37m",
|
|
77956
|
+
// 亮色
|
|
77957
|
+
bright_black: "\x1B[90m",
|
|
77958
|
+
bright_red: "\x1B[91m",
|
|
77959
|
+
bright_green: "\x1B[92m",
|
|
77960
|
+
bright_yellow: "\x1B[93m",
|
|
77961
|
+
bright_blue: "\x1B[94m",
|
|
77962
|
+
bright_magenta: "\x1B[95m",
|
|
77963
|
+
bright_cyan: "\x1B[96m",
|
|
77964
|
+
bright_white: "\x1B[97m",
|
|
77965
|
+
// 背景颜色
|
|
77966
|
+
bg_black: "\x1B[40m",
|
|
77967
|
+
bg_red: "\x1B[41m",
|
|
77968
|
+
bg_green: "\x1B[42m",
|
|
77969
|
+
bg_yellow: "\x1B[43m",
|
|
77970
|
+
bg_blue: "\x1B[44m",
|
|
77971
|
+
bg_magenta: "\x1B[45m",
|
|
77972
|
+
bg_cyan: "\x1B[46m",
|
|
77973
|
+
bg_white: "\x1B[47m",
|
|
77974
|
+
// 亮背景色
|
|
77975
|
+
bg_bright_black: "\x1B[100m",
|
|
77976
|
+
bg_bright_red: "\x1B[101m",
|
|
77977
|
+
bg_bright_green: "\x1B[102m",
|
|
77978
|
+
bg_bright_yellow: "\x1B[103m",
|
|
77979
|
+
bg_bright_blue: "\x1B[104m",
|
|
77980
|
+
bg_bright_magenta: "\x1B[105m",
|
|
77981
|
+
bg_bright_cyan: "\x1B[106m",
|
|
77982
|
+
bg_bright_white: "\x1B[107m"
|
|
77983
|
+
};
|
|
77984
|
+
var TRUE_COLOR_PREFIX = "\x1B[38;2;";
|
|
77985
|
+
function hexToRgb(hex) {
|
|
77986
|
+
hex = hex.replace(/^#/, "").trim();
|
|
77987
|
+
if (hex.length === 3) {
|
|
77988
|
+
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
77989
|
+
}
|
|
77990
|
+
if (hex.length !== 6) {
|
|
77991
|
+
return null;
|
|
77992
|
+
}
|
|
77993
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
77994
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
77995
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
77996
|
+
if (isNaN(r) || isNaN(g) || isNaN(b) || r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255) {
|
|
77997
|
+
return null;
|
|
77998
|
+
}
|
|
77999
|
+
return { r, g, b };
|
|
78000
|
+
}
|
|
78001
|
+
function getColorCode(colorName) {
|
|
78002
|
+
if (colorName.startsWith("#") || /^[0-9a-fA-F]{6}$/.test(colorName) || /^[0-9a-fA-F]{3}$/.test(colorName)) {
|
|
78003
|
+
const rgb = hexToRgb(colorName);
|
|
78004
|
+
if (rgb) {
|
|
78005
|
+
return `${TRUE_COLOR_PREFIX}${rgb.r};${rgb.g};${rgb.b}m`;
|
|
78006
|
+
}
|
|
78007
|
+
}
|
|
78008
|
+
return "";
|
|
78009
|
+
}
|
|
78010
|
+
function replaceVariables(text, variables) {
|
|
78011
|
+
return text.replace(/\{\{(\w+)\}\}/g, (match, varName) => {
|
|
78012
|
+
return variables[varName] || match;
|
|
78013
|
+
});
|
|
78014
|
+
}
|
|
78015
|
+
var DEFAULT_THEME = {
|
|
78016
|
+
modules: [
|
|
78017
|
+
{
|
|
78018
|
+
type: "workDir",
|
|
78019
|
+
icon: "\u{F024B}",
|
|
78020
|
+
// nf-md-folder_outline
|
|
78021
|
+
text: "{{workDirName}}",
|
|
78022
|
+
color: "bright_blue"
|
|
78023
|
+
},
|
|
78024
|
+
{
|
|
78025
|
+
type: "gitBranch",
|
|
78026
|
+
icon: "\uE725",
|
|
78027
|
+
// nf-dev-git_branch
|
|
78028
|
+
text: "{{gitBranch}}",
|
|
78029
|
+
color: "bright_magenta"
|
|
78030
|
+
},
|
|
78031
|
+
{
|
|
78032
|
+
type: "model",
|
|
78033
|
+
icon: "\u{F06A9}",
|
|
78034
|
+
// nf-md-robot_outline
|
|
78035
|
+
text: "{{model}}",
|
|
78036
|
+
color: "bright_cyan"
|
|
78037
|
+
},
|
|
78038
|
+
{
|
|
78039
|
+
type: "usage",
|
|
78040
|
+
icon: "\u2191",
|
|
78041
|
+
// 上箭头
|
|
78042
|
+
text: "{{inputTokens}}",
|
|
78043
|
+
color: "bright_green"
|
|
78044
|
+
},
|
|
78045
|
+
{
|
|
78046
|
+
type: "usage",
|
|
78047
|
+
icon: "\u2193",
|
|
78048
|
+
// 下箭头
|
|
78049
|
+
text: "{{outputTokens}}",
|
|
78050
|
+
color: "bright_yellow"
|
|
78051
|
+
}
|
|
78052
|
+
]
|
|
78053
|
+
};
|
|
78054
|
+
var POWERLINE_THEME = {
|
|
78055
|
+
modules: [
|
|
78056
|
+
{
|
|
78057
|
+
type: "workDir",
|
|
78058
|
+
icon: "\u{F024B}",
|
|
78059
|
+
// nf-md-folder_outline
|
|
78060
|
+
text: "{{workDirName}}",
|
|
78061
|
+
color: "white",
|
|
78062
|
+
background: "bg_bright_blue"
|
|
78063
|
+
},
|
|
78064
|
+
{
|
|
78065
|
+
type: "gitBranch",
|
|
78066
|
+
icon: "\uE725",
|
|
78067
|
+
// nf-dev-git_branch
|
|
78068
|
+
text: "{{gitBranch}}",
|
|
78069
|
+
color: "white",
|
|
78070
|
+
background: "bg_bright_magenta"
|
|
78071
|
+
},
|
|
78072
|
+
{
|
|
78073
|
+
type: "model",
|
|
78074
|
+
icon: "\u{F06A9}",
|
|
78075
|
+
// nf-md-robot_outline
|
|
78076
|
+
text: "{{model}}",
|
|
78077
|
+
color: "white",
|
|
78078
|
+
background: "bg_bright_cyan"
|
|
78079
|
+
},
|
|
78080
|
+
{
|
|
78081
|
+
type: "usage",
|
|
78082
|
+
icon: "\u2191",
|
|
78083
|
+
// 上箭头
|
|
78084
|
+
text: "{{inputTokens}}",
|
|
78085
|
+
color: "white",
|
|
78086
|
+
background: "bg_bright_green"
|
|
78087
|
+
},
|
|
78088
|
+
{
|
|
78089
|
+
type: "usage",
|
|
78090
|
+
icon: "\u2193",
|
|
78091
|
+
// 下箭头
|
|
78092
|
+
text: "{{outputTokens}}",
|
|
78093
|
+
color: "white",
|
|
78094
|
+
background: "bg_bright_yellow"
|
|
78095
|
+
}
|
|
78096
|
+
]
|
|
78097
|
+
};
|
|
78098
|
+
var SIMPLE_THEME = {
|
|
78099
|
+
modules: [
|
|
78100
|
+
{
|
|
78101
|
+
type: "workDir",
|
|
78102
|
+
icon: "",
|
|
78103
|
+
text: "{{workDirName}}",
|
|
78104
|
+
color: "bright_blue"
|
|
78105
|
+
},
|
|
78106
|
+
{
|
|
78107
|
+
type: "gitBranch",
|
|
78108
|
+
icon: "",
|
|
78109
|
+
text: "{{gitBranch}}",
|
|
78110
|
+
color: "bright_magenta"
|
|
78111
|
+
},
|
|
78112
|
+
{
|
|
78113
|
+
type: "model",
|
|
78114
|
+
icon: "",
|
|
78115
|
+
text: "{{model}}",
|
|
78116
|
+
color: "bright_cyan"
|
|
78117
|
+
},
|
|
78118
|
+
{
|
|
78119
|
+
type: "usage",
|
|
78120
|
+
icon: "\u2191",
|
|
78121
|
+
text: "{{inputTokens}}",
|
|
78122
|
+
color: "bright_green"
|
|
78123
|
+
},
|
|
78124
|
+
{
|
|
78125
|
+
type: "usage",
|
|
78126
|
+
icon: "\u2193",
|
|
78127
|
+
text: "{{outputTokens}}",
|
|
78128
|
+
color: "bright_yellow"
|
|
78129
|
+
}
|
|
78130
|
+
]
|
|
78131
|
+
};
|
|
78132
|
+
function formatUsage(input_tokens, output_tokens) {
|
|
78133
|
+
if (input_tokens > 1e3 || output_tokens > 1e3) {
|
|
78134
|
+
const inputFormatted = input_tokens > 1e3 ? `${(input_tokens / 1e3).toFixed(1)}k` : `${input_tokens}`;
|
|
78135
|
+
const outputFormatted = output_tokens > 1e3 ? `${(output_tokens / 1e3).toFixed(1)}k` : `${output_tokens}`;
|
|
78136
|
+
return `${inputFormatted} ${outputFormatted}`;
|
|
78137
|
+
}
|
|
78138
|
+
return `${input_tokens} ${output_tokens}`;
|
|
78139
|
+
}
|
|
78140
|
+
async function getProjectThemeConfig() {
|
|
78141
|
+
try {
|
|
78142
|
+
const configPath = CONFIG_FILE;
|
|
78143
|
+
try {
|
|
78144
|
+
await import_promises5.default.access(configPath);
|
|
78145
|
+
} catch {
|
|
78146
|
+
return { theme: null, style: "default" };
|
|
78147
|
+
}
|
|
78148
|
+
const configContent = await import_promises5.default.readFile(configPath, "utf-8");
|
|
78149
|
+
const config = import_json52.default.parse(configContent);
|
|
78150
|
+
if (config.StatusLine) {
|
|
78151
|
+
const currentStyle = config.StatusLine.currentStyle || "default";
|
|
78152
|
+
if (config.StatusLine[currentStyle] && config.StatusLine[currentStyle].modules) {
|
|
78153
|
+
return { theme: config.StatusLine[currentStyle], style: currentStyle };
|
|
78154
|
+
}
|
|
78155
|
+
}
|
|
78156
|
+
} catch (error) {
|
|
78157
|
+
}
|
|
78158
|
+
return { theme: null, style: "default" };
|
|
78159
|
+
}
|
|
78160
|
+
function shouldUseSimpleTheme() {
|
|
78161
|
+
if (process.env.USE_SIMPLE_ICONS === "true") {
|
|
78162
|
+
return true;
|
|
78163
|
+
}
|
|
78164
|
+
const term = process.env.TERM || "";
|
|
78165
|
+
const unsupportedTerms = ["dumb", "unknown"];
|
|
78166
|
+
if (unsupportedTerms.includes(term)) {
|
|
78167
|
+
return true;
|
|
78168
|
+
}
|
|
78169
|
+
return false;
|
|
78170
|
+
}
|
|
78171
|
+
function canDisplayNerdFonts() {
|
|
78172
|
+
if (process.env.USE_SIMPLE_ICONS === "true") {
|
|
78173
|
+
return false;
|
|
78174
|
+
}
|
|
78175
|
+
const fontEnvVars = ["NERD_FONT", "NERDFONT", "FONT"];
|
|
78176
|
+
for (const envVar of fontEnvVars) {
|
|
78177
|
+
const value = process.env[envVar];
|
|
78178
|
+
if (value && (value.includes("Nerd") || value.includes("nerd"))) {
|
|
78179
|
+
return true;
|
|
78180
|
+
}
|
|
78181
|
+
}
|
|
78182
|
+
const termProgram = process.env.TERM_PROGRAM || "";
|
|
78183
|
+
const supportedTerminals = ["iTerm.app", "vscode", "Hyper", "kitty", "alacritty"];
|
|
78184
|
+
if (supportedTerminals.includes(termProgram)) {
|
|
78185
|
+
return true;
|
|
78186
|
+
}
|
|
78187
|
+
const colorTerm = process.env.COLORTERM || "";
|
|
78188
|
+
if (colorTerm.includes("truecolor") || colorTerm.includes("24bit")) {
|
|
78189
|
+
return true;
|
|
78190
|
+
}
|
|
78191
|
+
return process.env.USE_SIMPLE_ICONS !== "true";
|
|
78192
|
+
}
|
|
78193
|
+
async function parseStatusLineData(input) {
|
|
78194
|
+
try {
|
|
78195
|
+
const useSimpleTheme = shouldUseSimpleTheme();
|
|
78196
|
+
const canDisplayNerd = canDisplayNerdFonts();
|
|
78197
|
+
const effectiveTheme = useSimpleTheme || !canDisplayNerd ? SIMPLE_THEME : DEFAULT_THEME;
|
|
78198
|
+
const { theme: projectTheme, style: currentStyle } = await getProjectThemeConfig();
|
|
78199
|
+
const theme = projectTheme || effectiveTheme;
|
|
78200
|
+
const workDir = input.workspace.current_dir;
|
|
78201
|
+
let gitBranch = "";
|
|
78202
|
+
try {
|
|
78203
|
+
gitBranch = (0, import_child_process4.execSync)("git branch --show-current", {
|
|
78204
|
+
cwd: workDir,
|
|
78205
|
+
stdio: ["pipe", "pipe", "ignore"]
|
|
78206
|
+
}).toString().trim();
|
|
78207
|
+
} catch (error) {
|
|
78208
|
+
}
|
|
78209
|
+
const transcriptContent = await import_promises5.default.readFile(input.transcript_path, "utf-8");
|
|
78210
|
+
const lines = transcriptContent.trim().split("\n");
|
|
78211
|
+
let model = "";
|
|
78212
|
+
let inputTokens = 0;
|
|
78213
|
+
let outputTokens = 0;
|
|
78214
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
78215
|
+
try {
|
|
78216
|
+
const message = JSON.parse(lines[i]);
|
|
78217
|
+
if (message.type === "assistant" && message.message.model) {
|
|
78218
|
+
model = message.message.model;
|
|
78219
|
+
if (message.message.usage) {
|
|
78220
|
+
inputTokens = message.message.usage.input_tokens;
|
|
78221
|
+
outputTokens = message.message.usage.output_tokens;
|
|
78222
|
+
}
|
|
78223
|
+
break;
|
|
78224
|
+
}
|
|
78225
|
+
} catch (parseError) {
|
|
78226
|
+
continue;
|
|
78227
|
+
}
|
|
78228
|
+
}
|
|
78229
|
+
if (!model) {
|
|
78230
|
+
try {
|
|
78231
|
+
const projectConfigPath = import_node_path6.default.join(workDir, ".claude-code-router", "config.json");
|
|
78232
|
+
let configPath = projectConfigPath;
|
|
78233
|
+
try {
|
|
78234
|
+
await import_promises5.default.access(projectConfigPath);
|
|
78235
|
+
} catch {
|
|
78236
|
+
configPath = CONFIG_FILE;
|
|
78237
|
+
}
|
|
78238
|
+
const configContent = await import_promises5.default.readFile(configPath, "utf-8");
|
|
78239
|
+
const config = import_json52.default.parse(configContent);
|
|
78240
|
+
if (config.Router && config.Router.default) {
|
|
78241
|
+
const [, defaultModel] = config.Router.default.split(",");
|
|
78242
|
+
if (defaultModel) {
|
|
78243
|
+
model = defaultModel.trim();
|
|
78244
|
+
}
|
|
78245
|
+
}
|
|
78246
|
+
} catch (configError) {
|
|
78247
|
+
}
|
|
78248
|
+
}
|
|
78249
|
+
if (!model) {
|
|
78250
|
+
model = input.model.display_name;
|
|
78251
|
+
}
|
|
78252
|
+
const workDirName = workDir.split("/").pop() || "";
|
|
78253
|
+
const usage = formatUsage(inputTokens, outputTokens);
|
|
78254
|
+
const [formattedInputTokens, formattedOutputTokens] = usage.split(" ");
|
|
78255
|
+
const variables = {
|
|
78256
|
+
workDirName,
|
|
78257
|
+
gitBranch,
|
|
78258
|
+
model,
|
|
78259
|
+
inputTokens: formattedInputTokens,
|
|
78260
|
+
outputTokens: formattedOutputTokens
|
|
78261
|
+
};
|
|
78262
|
+
const isPowerline = currentStyle === "powerline";
|
|
78263
|
+
if (isPowerline) {
|
|
78264
|
+
return renderPowerlineStyle(theme, variables);
|
|
78265
|
+
} else {
|
|
78266
|
+
return renderDefaultStyle(theme, variables);
|
|
78267
|
+
}
|
|
78268
|
+
} catch (error) {
|
|
78269
|
+
return "";
|
|
78270
|
+
}
|
|
78271
|
+
}
|
|
78272
|
+
function renderDefaultStyle(theme, variables) {
|
|
78273
|
+
const modules = theme.modules || DEFAULT_THEME.modules;
|
|
78274
|
+
const parts = [];
|
|
78275
|
+
for (let i = 0; i < Math.min(modules.length, 5); i++) {
|
|
78276
|
+
const module2 = modules[i];
|
|
78277
|
+
const color = module2.color ? getColorCode(module2.color) : "";
|
|
78278
|
+
const background = module2.background ? getColorCode(module2.background) : "";
|
|
78279
|
+
const icon = module2.icon || "";
|
|
78280
|
+
const text = replaceVariables(module2.text, variables);
|
|
78281
|
+
if (!text && module2.type !== "usage") {
|
|
78282
|
+
continue;
|
|
78283
|
+
}
|
|
78284
|
+
let part = `${background}${color}`;
|
|
78285
|
+
if (icon) {
|
|
78286
|
+
part += `${icon} `;
|
|
78287
|
+
}
|
|
78288
|
+
part += `${text}${COLORS.reset}`;
|
|
78289
|
+
parts.push(part);
|
|
78290
|
+
}
|
|
78291
|
+
return parts.join(" ");
|
|
78292
|
+
}
|
|
78293
|
+
var SEP_RIGHT = "\uE0B0";
|
|
78294
|
+
var COLOR_MAP = {
|
|
78295
|
+
// 基础颜色映射到256色
|
|
78296
|
+
black: 0,
|
|
78297
|
+
red: 1,
|
|
78298
|
+
green: 2,
|
|
78299
|
+
yellow: 3,
|
|
78300
|
+
blue: 4,
|
|
78301
|
+
magenta: 5,
|
|
78302
|
+
cyan: 6,
|
|
78303
|
+
white: 7,
|
|
78304
|
+
bright_black: 8,
|
|
78305
|
+
bright_red: 9,
|
|
78306
|
+
bright_green: 10,
|
|
78307
|
+
bright_yellow: 11,
|
|
78308
|
+
bright_blue: 12,
|
|
78309
|
+
bright_magenta: 13,
|
|
78310
|
+
bright_cyan: 14,
|
|
78311
|
+
bright_white: 15,
|
|
78312
|
+
// 亮背景色映射
|
|
78313
|
+
bg_black: 0,
|
|
78314
|
+
bg_red: 1,
|
|
78315
|
+
bg_green: 2,
|
|
78316
|
+
bg_yellow: 3,
|
|
78317
|
+
bg_blue: 4,
|
|
78318
|
+
bg_magenta: 5,
|
|
78319
|
+
bg_cyan: 6,
|
|
78320
|
+
bg_white: 7,
|
|
78321
|
+
bg_bright_black: 8,
|
|
78322
|
+
bg_bright_red: 9,
|
|
78323
|
+
bg_bright_green: 10,
|
|
78324
|
+
bg_bright_yellow: 11,
|
|
78325
|
+
bg_bright_blue: 12,
|
|
78326
|
+
bg_bright_magenta: 13,
|
|
78327
|
+
bg_bright_cyan: 14,
|
|
78328
|
+
bg_bright_white: 15,
|
|
78329
|
+
// 自定义颜色映射
|
|
78330
|
+
bg_bright_orange: 202,
|
|
78331
|
+
bg_bright_purple: 129
|
|
78332
|
+
};
|
|
78333
|
+
function getTrueColorRgb(colorName) {
|
|
78334
|
+
if (COLOR_MAP[colorName] !== void 0) {
|
|
78335
|
+
const color256 = COLOR_MAP[colorName];
|
|
78336
|
+
return color256ToRgb(color256);
|
|
78337
|
+
}
|
|
78338
|
+
if (colorName.startsWith("#") || /^[0-9a-fA-F]{6}$/.test(colorName) || /^[0-9a-fA-F]{3}$/.test(colorName)) {
|
|
78339
|
+
return hexToRgb(colorName);
|
|
78340
|
+
}
|
|
78341
|
+
if (colorName.startsWith("bg_#")) {
|
|
78342
|
+
return hexToRgb(colorName.substring(3));
|
|
78343
|
+
}
|
|
78344
|
+
return null;
|
|
78345
|
+
}
|
|
78346
|
+
function color256ToRgb(index) {
|
|
78347
|
+
if (index < 0 || index > 255) return null;
|
|
78348
|
+
if (index < 16) {
|
|
78349
|
+
const basicColors = [
|
|
78350
|
+
[0, 0, 0],
|
|
78351
|
+
[128, 0, 0],
|
|
78352
|
+
[0, 128, 0],
|
|
78353
|
+
[128, 128, 0],
|
|
78354
|
+
[0, 0, 128],
|
|
78355
|
+
[128, 0, 128],
|
|
78356
|
+
[0, 128, 128],
|
|
78357
|
+
[192, 192, 192],
|
|
78358
|
+
[128, 128, 128],
|
|
78359
|
+
[255, 0, 0],
|
|
78360
|
+
[0, 255, 0],
|
|
78361
|
+
[255, 255, 0],
|
|
78362
|
+
[0, 0, 255],
|
|
78363
|
+
[255, 0, 255],
|
|
78364
|
+
[0, 255, 255],
|
|
78365
|
+
[255, 255, 255]
|
|
78366
|
+
];
|
|
78367
|
+
return { r: basicColors[index][0], g: basicColors[index][1], b: basicColors[index][2] };
|
|
78368
|
+
} else if (index < 232) {
|
|
78369
|
+
const i = index - 16;
|
|
78370
|
+
const r = Math.floor(i / 36);
|
|
78371
|
+
const g = Math.floor(i % 36 / 6);
|
|
78372
|
+
const b = i % 6;
|
|
78373
|
+
const rgb = [0, 95, 135, 175, 215, 255];
|
|
78374
|
+
return { r: rgb[r], g: rgb[g], b: rgb[b] };
|
|
78375
|
+
} else {
|
|
78376
|
+
const gray = 8 + (index - 232) * 10;
|
|
78377
|
+
return { r: gray, g: gray, b: gray };
|
|
78378
|
+
}
|
|
78379
|
+
}
|
|
78380
|
+
function segment(text, textFg, bgColor, nextBgColor) {
|
|
78381
|
+
const bgRgb = getTrueColorRgb(bgColor);
|
|
78382
|
+
if (!bgRgb) {
|
|
78383
|
+
const defaultBlueRgb = { r: 33, g: 150, b: 243 };
|
|
78384
|
+
const curBg2 = `\x1B[48;2;${defaultBlueRgb.r};${defaultBlueRgb.g};${defaultBlueRgb.b}m`;
|
|
78385
|
+
const fgColor2 = `\x1B[38;2;255;255;255m`;
|
|
78386
|
+
const body2 = `${curBg2}${fgColor2} ${text} \x1B[0m`;
|
|
78387
|
+
return body2;
|
|
78388
|
+
}
|
|
78389
|
+
const curBg = `\x1B[48;2;${bgRgb.r};${bgRgb.g};${bgRgb.b}m`;
|
|
78390
|
+
let fgRgb = { r: 255, g: 255, b: 255 };
|
|
78391
|
+
const textFgRgb = getTrueColorRgb(textFg);
|
|
78392
|
+
if (textFgRgb) {
|
|
78393
|
+
fgRgb = textFgRgb;
|
|
78394
|
+
}
|
|
78395
|
+
const fgColor = `\x1B[38;2;${fgRgb.r};${fgRgb.g};${fgRgb.b}m`;
|
|
78396
|
+
const body = `${curBg}${fgColor} ${text} \x1B[0m`;
|
|
78397
|
+
if (nextBgColor != null) {
|
|
78398
|
+
const nextBgRgb = getTrueColorRgb(nextBgColor);
|
|
78399
|
+
if (nextBgRgb) {
|
|
78400
|
+
const sepCurFg2 = `\x1B[38;2;${bgRgb.r};${bgRgb.g};${bgRgb.b}m`;
|
|
78401
|
+
const sepNextBg2 = `\x1B[48;2;${nextBgRgb.r};${nextBgRgb.g};${nextBgRgb.b}m`;
|
|
78402
|
+
const sep3 = `${sepCurFg2}${sepNextBg2}${SEP_RIGHT}\x1B[0m`;
|
|
78403
|
+
return body + sep3;
|
|
78404
|
+
}
|
|
78405
|
+
const sepCurFg = `\x1B[38;2;${bgRgb.r};${bgRgb.g};${bgRgb.b}m`;
|
|
78406
|
+
const sepNextBg = `\x1B[48;2;0;0;0m`;
|
|
78407
|
+
const sep2 = `${sepCurFg}${sepNextBg}${SEP_RIGHT}\x1B[0m`;
|
|
78408
|
+
return body + sep2;
|
|
78409
|
+
}
|
|
78410
|
+
return body;
|
|
78411
|
+
}
|
|
78412
|
+
function renderPowerlineStyle(theme, variables) {
|
|
78413
|
+
const modules = theme.modules || POWERLINE_THEME.modules;
|
|
78414
|
+
const segments = [];
|
|
78415
|
+
for (let i = 0; i < Math.min(modules.length, 5); i++) {
|
|
78416
|
+
const module2 = modules[i];
|
|
78417
|
+
const color = module2.color || "white";
|
|
78418
|
+
const backgroundName = module2.background || "";
|
|
78419
|
+
const icon = module2.icon || "";
|
|
78420
|
+
const text = replaceVariables(module2.text, variables);
|
|
78421
|
+
if (!text && module2.type !== "usage") {
|
|
78422
|
+
continue;
|
|
78423
|
+
}
|
|
78424
|
+
let displayText = "";
|
|
78425
|
+
if (icon) {
|
|
78426
|
+
displayText += `${icon} `;
|
|
78427
|
+
}
|
|
78428
|
+
displayText += text;
|
|
78429
|
+
let nextBackground = null;
|
|
78430
|
+
if (i < modules.length - 1) {
|
|
78431
|
+
const nextModule = modules[i + 1];
|
|
78432
|
+
nextBackground = nextModule.background || null;
|
|
78433
|
+
}
|
|
78434
|
+
const actualBackground = backgroundName || "bg_bright_blue";
|
|
78435
|
+
const segmentStr = segment(displayText, color, actualBackground, nextBackground);
|
|
78436
|
+
segments.push(segmentStr);
|
|
78437
|
+
}
|
|
78438
|
+
return segments.join("");
|
|
78439
|
+
}
|
|
78440
|
+
|
|
77934
78441
|
// src/cli.ts
|
|
77935
78442
|
var import_package = __toESM(require_package3());
|
|
77936
|
-
var
|
|
78443
|
+
var import_child_process5 = require("child_process");
|
|
77937
78444
|
init_constants();
|
|
77938
78445
|
var import_fs6 = __toESM(require("fs"));
|
|
77939
78446
|
var import_path6 = require("path");
|
|
@@ -77946,6 +78453,7 @@ Commands:
|
|
|
77946
78453
|
stop Stop server
|
|
77947
78454
|
restart Restart server
|
|
77948
78455
|
status Show server status
|
|
78456
|
+
statusline Integrated statusline
|
|
77949
78457
|
code Execute claude command
|
|
77950
78458
|
ui Open the web UI in browser
|
|
77951
78459
|
-v, version Show version information
|
|
@@ -77997,11 +78505,31 @@ async function main() {
|
|
|
77997
78505
|
case "status":
|
|
77998
78506
|
await showStatus();
|
|
77999
78507
|
break;
|
|
78508
|
+
case "statusline":
|
|
78509
|
+
let inputData = "";
|
|
78510
|
+
process.stdin.setEncoding("utf-8");
|
|
78511
|
+
process.stdin.on("readable", () => {
|
|
78512
|
+
let chunk;
|
|
78513
|
+
while ((chunk = process.stdin.read()) !== null) {
|
|
78514
|
+
inputData += chunk;
|
|
78515
|
+
}
|
|
78516
|
+
});
|
|
78517
|
+
process.stdin.on("end", async () => {
|
|
78518
|
+
try {
|
|
78519
|
+
const input = JSON.parse(inputData);
|
|
78520
|
+
const statusLine = await parseStatusLineData(input);
|
|
78521
|
+
console.log(statusLine);
|
|
78522
|
+
} catch (error) {
|
|
78523
|
+
console.error("Error parsing status line data:", error);
|
|
78524
|
+
process.exit(1);
|
|
78525
|
+
}
|
|
78526
|
+
});
|
|
78527
|
+
break;
|
|
78000
78528
|
case "code":
|
|
78001
78529
|
if (!isServiceRunning()) {
|
|
78002
78530
|
console.log("Service not running, starting service...");
|
|
78003
78531
|
const cliPath2 = (0, import_path6.join)(__dirname, "cli.js");
|
|
78004
|
-
const startProcess2 = (0,
|
|
78532
|
+
const startProcess2 = (0, import_child_process5.spawn)("node", [cliPath2, "start"], {
|
|
78005
78533
|
detached: true,
|
|
78006
78534
|
stdio: "ignore"
|
|
78007
78535
|
});
|
|
@@ -78028,7 +78556,7 @@ async function main() {
|
|
|
78028
78556
|
if (!isServiceRunning()) {
|
|
78029
78557
|
console.log("Service not running, starting service...");
|
|
78030
78558
|
const cliPath2 = (0, import_path6.join)(__dirname, "cli.js");
|
|
78031
|
-
const startProcess2 = (0,
|
|
78559
|
+
const startProcess2 = (0, import_child_process5.spawn)("node", [cliPath2, "start"], {
|
|
78032
78560
|
detached: true,
|
|
78033
78561
|
stdio: "ignore"
|
|
78034
78562
|
});
|
|
@@ -78065,7 +78593,7 @@ async function main() {
|
|
|
78065
78593
|
console.log(
|
|
78066
78594
|
"Please edit this file with your actual configuration."
|
|
78067
78595
|
);
|
|
78068
|
-
const restartProcess = (0,
|
|
78596
|
+
const restartProcess = (0, import_child_process5.spawn)("node", [cliPath2, "start"], {
|
|
78069
78597
|
detached: true,
|
|
78070
78598
|
stdio: "ignore"
|
|
78071
78599
|
});
|
|
@@ -78107,7 +78635,7 @@ async function main() {
|
|
|
78107
78635
|
console.error("Unsupported platform for opening browser");
|
|
78108
78636
|
process.exit(1);
|
|
78109
78637
|
}
|
|
78110
|
-
(0,
|
|
78638
|
+
(0, import_child_process5.exec)(openCommand, (error) => {
|
|
78111
78639
|
if (error) {
|
|
78112
78640
|
console.error("Failed to open browser:", error.message);
|
|
78113
78641
|
process.exit(1);
|
|
@@ -78136,7 +78664,7 @@ async function main() {
|
|
|
78136
78664
|
}
|
|
78137
78665
|
console.log("Starting claude code router service...");
|
|
78138
78666
|
const cliPath = (0, import_path6.join)(__dirname, "cli.js");
|
|
78139
|
-
const startProcess = (0,
|
|
78667
|
+
const startProcess = (0, import_child_process5.spawn)("node", [cliPath, "start"], {
|
|
78140
78668
|
detached: true,
|
|
78141
78669
|
stdio: "ignore"
|
|
78142
78670
|
});
|