@n-dream/builders-cli 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builders-cli.cjs +651 -487
- package/package.json +1 -1
package/dist/builders-cli.cjs
CHANGED
|
@@ -364,43 +364,43 @@ var require_permessage_deflate = __commonJS({
|
|
|
364
364
|
normalizeParams(configurations) {
|
|
365
365
|
configurations.forEach((params) => {
|
|
366
366
|
Object.keys(params).forEach((key) => {
|
|
367
|
-
let
|
|
368
|
-
if (
|
|
367
|
+
let value2 = params[key];
|
|
368
|
+
if (value2.length > 1) {
|
|
369
369
|
throw new Error(`Parameter "${key}" must have only a single value`);
|
|
370
370
|
}
|
|
371
|
-
|
|
371
|
+
value2 = value2[0];
|
|
372
372
|
if (key === "client_max_window_bits") {
|
|
373
|
-
if (
|
|
374
|
-
const num = +
|
|
373
|
+
if (value2 !== true) {
|
|
374
|
+
const num = +value2;
|
|
375
375
|
if (!Number.isInteger(num) || num < 8 || num > 15) {
|
|
376
376
|
throw new TypeError(
|
|
377
|
-
`Invalid value for parameter "${key}": ${
|
|
377
|
+
`Invalid value for parameter "${key}": ${value2}`
|
|
378
378
|
);
|
|
379
379
|
}
|
|
380
|
-
|
|
380
|
+
value2 = num;
|
|
381
381
|
} else if (!this._isServer) {
|
|
382
382
|
throw new TypeError(
|
|
383
|
-
`Invalid value for parameter "${key}": ${
|
|
383
|
+
`Invalid value for parameter "${key}": ${value2}`
|
|
384
384
|
);
|
|
385
385
|
}
|
|
386
386
|
} else if (key === "server_max_window_bits") {
|
|
387
|
-
const num = +
|
|
387
|
+
const num = +value2;
|
|
388
388
|
if (!Number.isInteger(num) || num < 8 || num > 15) {
|
|
389
389
|
throw new TypeError(
|
|
390
|
-
`Invalid value for parameter "${key}": ${
|
|
390
|
+
`Invalid value for parameter "${key}": ${value2}`
|
|
391
391
|
);
|
|
392
392
|
}
|
|
393
|
-
|
|
393
|
+
value2 = num;
|
|
394
394
|
} else if (key === "client_no_context_takeover" || key === "server_no_context_takeover") {
|
|
395
|
-
if (
|
|
395
|
+
if (value2 !== true) {
|
|
396
396
|
throw new TypeError(
|
|
397
|
-
`Invalid value for parameter "${key}": ${
|
|
397
|
+
`Invalid value for parameter "${key}": ${value2}`
|
|
398
398
|
);
|
|
399
399
|
}
|
|
400
400
|
} else {
|
|
401
401
|
throw new Error(`Unknown parameter "${key}"`);
|
|
402
402
|
}
|
|
403
|
-
params[key] =
|
|
403
|
+
params[key] = value2;
|
|
404
404
|
});
|
|
405
405
|
});
|
|
406
406
|
return configurations;
|
|
@@ -737,8 +737,8 @@ var require_validation = __commonJS({
|
|
|
737
737
|
}
|
|
738
738
|
return true;
|
|
739
739
|
}
|
|
740
|
-
function isBlob(
|
|
741
|
-
return hasBlob && typeof
|
|
740
|
+
function isBlob(value2) {
|
|
741
|
+
return hasBlob && typeof value2 === "object" && typeof value2.arrayBuffer === "function" && typeof value2.type === "string" && typeof value2.stream === "function" && (value2[Symbol.toStringTag] === "Blob" || value2[Symbol.toStringTag] === "File");
|
|
742
742
|
}
|
|
743
743
|
module2.exports = {
|
|
744
744
|
isBlob,
|
|
@@ -2204,12 +2204,12 @@ var require_extension = __commonJS({
|
|
|
2204
2204
|
throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
2205
2205
|
}
|
|
2206
2206
|
if (end === -1) end = i;
|
|
2207
|
-
let
|
|
2207
|
+
let value2 = header.slice(start, end);
|
|
2208
2208
|
if (mustUnescape) {
|
|
2209
|
-
|
|
2209
|
+
value2 = value2.replace(/\\/g, "");
|
|
2210
2210
|
mustUnescape = false;
|
|
2211
2211
|
}
|
|
2212
|
-
push(params, paramName,
|
|
2212
|
+
push(params, paramName, value2);
|
|
2213
2213
|
if (code === 44) {
|
|
2214
2214
|
push(offers, extensionName, params);
|
|
2215
2215
|
params = /* @__PURE__ */ Object.create(null);
|
|
@@ -2269,7 +2269,7 @@ var require_websocket = __commonJS({
|
|
|
2269
2269
|
var http3 = require("http");
|
|
2270
2270
|
var net = require("net");
|
|
2271
2271
|
var tls = require("tls");
|
|
2272
|
-
var { randomBytes:
|
|
2272
|
+
var { randomBytes: randomBytes3, createHash } = require("crypto");
|
|
2273
2273
|
var { Duplex, Readable } = require("stream");
|
|
2274
2274
|
var { URL: URL2 } = require("url");
|
|
2275
2275
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
@@ -2820,7 +2820,7 @@ var require_websocket = __commonJS({
|
|
|
2820
2820
|
}
|
|
2821
2821
|
}
|
|
2822
2822
|
const defaultPort2 = isSecure ? 443 : 80;
|
|
2823
|
-
const key =
|
|
2823
|
+
const key = randomBytes3(16).toString("base64");
|
|
2824
2824
|
const request = isSecure ? https.request : http3.request;
|
|
2825
2825
|
const protocolSet = /* @__PURE__ */ new Set();
|
|
2826
2826
|
let perMessageDeflate;
|
|
@@ -2882,8 +2882,8 @@ var require_websocket = __commonJS({
|
|
|
2882
2882
|
const headers = options && options.headers;
|
|
2883
2883
|
options = { ...options, headers: {} };
|
|
2884
2884
|
if (headers) {
|
|
2885
|
-
for (const [key2,
|
|
2886
|
-
options.headers[key2.toLowerCase()] =
|
|
2885
|
+
for (const [key2, value2] of Object.entries(headers)) {
|
|
2886
|
+
options.headers[key2.toLowerCase()] = value2;
|
|
2887
2887
|
}
|
|
2888
2888
|
}
|
|
2889
2889
|
} else if (websocket.listenerCount("redirect") === 0) {
|
|
@@ -3643,10 +3643,10 @@ var require_websocket_server = __commonJS({
|
|
|
3643
3643
|
}
|
|
3644
3644
|
if (extensions[PerMessageDeflate2.extensionName]) {
|
|
3645
3645
|
const params = extensions[PerMessageDeflate2.extensionName].params;
|
|
3646
|
-
const
|
|
3646
|
+
const value2 = extension2.format({
|
|
3647
3647
|
[PerMessageDeflate2.extensionName]: [params]
|
|
3648
3648
|
});
|
|
3649
|
-
headers.push(`Sec-WebSocket-Extensions: ${
|
|
3649
|
+
headers.push(`Sec-WebSocket-Extensions: ${value2}`);
|
|
3650
3650
|
ws._extensions = extensions;
|
|
3651
3651
|
}
|
|
3652
3652
|
this.emit("headers", headers, req);
|
|
@@ -4536,8 +4536,8 @@ var require_helpers = __commonJS({
|
|
|
4536
4536
|
function req(url, opts = {}) {
|
|
4537
4537
|
const href = typeof url === "string" ? url : url.href;
|
|
4538
4538
|
const req2 = (href.startsWith("https:") ? https : http3).request(url, opts);
|
|
4539
|
-
const promise = new Promise((
|
|
4540
|
-
req2.once("response",
|
|
4539
|
+
const promise = new Promise((resolve2, reject) => {
|
|
4540
|
+
req2.once("response", resolve2).once("error", reject).end();
|
|
4541
4541
|
});
|
|
4542
4542
|
req2.then = promise.then.bind(promise);
|
|
4543
4543
|
return req2;
|
|
@@ -4714,7 +4714,7 @@ var require_parse_proxy_response = __commonJS({
|
|
|
4714
4714
|
var debug_1 = __importDefault(require_src());
|
|
4715
4715
|
var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
4716
4716
|
function parseProxyResponse(socket) {
|
|
4717
|
-
return new Promise((
|
|
4717
|
+
return new Promise((resolve2, reject) => {
|
|
4718
4718
|
let buffersLength = 0;
|
|
4719
4719
|
const buffers = [];
|
|
4720
4720
|
function read() {
|
|
@@ -4768,19 +4768,19 @@ var require_parse_proxy_response = __commonJS({
|
|
|
4768
4768
|
return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
|
|
4769
4769
|
}
|
|
4770
4770
|
const key = header.slice(0, firstColon).toLowerCase();
|
|
4771
|
-
const
|
|
4771
|
+
const value2 = header.slice(firstColon + 1).trimStart();
|
|
4772
4772
|
const current = headers[key];
|
|
4773
4773
|
if (typeof current === "string") {
|
|
4774
|
-
headers[key] = [current,
|
|
4774
|
+
headers[key] = [current, value2];
|
|
4775
4775
|
} else if (Array.isArray(current)) {
|
|
4776
|
-
current.push(
|
|
4776
|
+
current.push(value2);
|
|
4777
4777
|
} else {
|
|
4778
|
-
headers[key] =
|
|
4778
|
+
headers[key] = value2;
|
|
4779
4779
|
}
|
|
4780
4780
|
}
|
|
4781
4781
|
debug("got proxy server response: %o %o", firstLine, headers);
|
|
4782
4782
|
cleanup();
|
|
4783
|
-
|
|
4783
|
+
resolve2({
|
|
4784
4784
|
connect: {
|
|
4785
4785
|
statusCode,
|
|
4786
4786
|
statusText,
|
|
@@ -5819,7 +5819,7 @@ var require_tree = __commonJS({
|
|
|
5819
5819
|
* @param {any} value
|
|
5820
5820
|
* @param {number} index
|
|
5821
5821
|
*/
|
|
5822
|
-
constructor(key,
|
|
5822
|
+
constructor(key, value2, index) {
|
|
5823
5823
|
if (index === void 0 || index >= key.length) {
|
|
5824
5824
|
throw new TypeError("Unreachable");
|
|
5825
5825
|
}
|
|
@@ -5828,9 +5828,9 @@ var require_tree = __commonJS({
|
|
|
5828
5828
|
throw new TypeError("key must be ascii string");
|
|
5829
5829
|
}
|
|
5830
5830
|
if (key.length !== ++index) {
|
|
5831
|
-
this.middle = new _TstNode(key,
|
|
5831
|
+
this.middle = new _TstNode(key, value2, index);
|
|
5832
5832
|
} else {
|
|
5833
|
-
this.value =
|
|
5833
|
+
this.value = value2;
|
|
5834
5834
|
}
|
|
5835
5835
|
}
|
|
5836
5836
|
/**
|
|
@@ -5838,7 +5838,7 @@ var require_tree = __commonJS({
|
|
|
5838
5838
|
* @param {any} value
|
|
5839
5839
|
* @returns {void}
|
|
5840
5840
|
*/
|
|
5841
|
-
add(key,
|
|
5841
|
+
add(key, value2) {
|
|
5842
5842
|
const length = key.length;
|
|
5843
5843
|
if (length === 0) {
|
|
5844
5844
|
throw new TypeError("Unreachable");
|
|
@@ -5852,25 +5852,25 @@ var require_tree = __commonJS({
|
|
|
5852
5852
|
}
|
|
5853
5853
|
if (node.code === code) {
|
|
5854
5854
|
if (length === ++index) {
|
|
5855
|
-
node.value =
|
|
5855
|
+
node.value = value2;
|
|
5856
5856
|
break;
|
|
5857
5857
|
} else if (node.middle !== null) {
|
|
5858
5858
|
node = node.middle;
|
|
5859
5859
|
} else {
|
|
5860
|
-
node.middle = new _TstNode(key,
|
|
5860
|
+
node.middle = new _TstNode(key, value2, index);
|
|
5861
5861
|
break;
|
|
5862
5862
|
}
|
|
5863
5863
|
} else if (node.code < code) {
|
|
5864
5864
|
if (node.left !== null) {
|
|
5865
5865
|
node = node.left;
|
|
5866
5866
|
} else {
|
|
5867
|
-
node.left = new _TstNode(key,
|
|
5867
|
+
node.left = new _TstNode(key, value2, index);
|
|
5868
5868
|
break;
|
|
5869
5869
|
}
|
|
5870
5870
|
} else if (node.right !== null) {
|
|
5871
5871
|
node = node.right;
|
|
5872
5872
|
} else {
|
|
5873
|
-
node.right = new _TstNode(key,
|
|
5873
|
+
node.right = new _TstNode(key, value2, index);
|
|
5874
5874
|
break;
|
|
5875
5875
|
}
|
|
5876
5876
|
}
|
|
@@ -5910,11 +5910,11 @@ var require_tree = __commonJS({
|
|
|
5910
5910
|
* @param {any} value
|
|
5911
5911
|
* @returns {void}
|
|
5912
5912
|
* */
|
|
5913
|
-
insert(key,
|
|
5913
|
+
insert(key, value2) {
|
|
5914
5914
|
if (this.node === null) {
|
|
5915
|
-
this.node = new TstNode(key,
|
|
5915
|
+
this.node = new TstNode(key, value2, 0);
|
|
5916
5916
|
} else {
|
|
5917
|
-
this.node.add(key,
|
|
5917
|
+
this.node.add(key, value2);
|
|
5918
5918
|
}
|
|
5919
5919
|
}
|
|
5920
5920
|
/**
|
|
@@ -6019,11 +6019,11 @@ var require_util = __commonJS({
|
|
|
6019
6019
|
return url;
|
|
6020
6020
|
}
|
|
6021
6021
|
function isValidPort(port) {
|
|
6022
|
-
const
|
|
6023
|
-
return
|
|
6022
|
+
const value2 = parseInt(port, 10);
|
|
6023
|
+
return value2 === Number(port) && value2 >= 0 && value2 <= 65535;
|
|
6024
6024
|
}
|
|
6025
|
-
function isHttpOrHttpsPrefixed(
|
|
6026
|
-
return
|
|
6025
|
+
function isHttpOrHttpsPrefixed(value2) {
|
|
6026
|
+
return value2 != null && value2[0] === "h" && value2[1] === "t" && value2[2] === "t" && value2[3] === "p" && (value2[4] === ":" || value2[4] === "s" && value2[5] === ":");
|
|
6027
6027
|
}
|
|
6028
6028
|
function parseURL(url) {
|
|
6029
6029
|
if (typeof url === "string") {
|
|
@@ -6152,11 +6152,11 @@ var require_util = __commonJS({
|
|
|
6152
6152
|
const m = val.match(KEEPALIVE_TIMEOUT_EXPR);
|
|
6153
6153
|
return m ? parseInt(m[1], 10) * 1e3 : null;
|
|
6154
6154
|
}
|
|
6155
|
-
function headerNameToString(
|
|
6156
|
-
return typeof
|
|
6155
|
+
function headerNameToString(value2) {
|
|
6156
|
+
return typeof value2 === "string" ? headerNameLowerCasedRecord[value2] ?? value2.toLowerCase() : tree.lookup(value2) ?? value2.toString("latin1").toLowerCase();
|
|
6157
6157
|
}
|
|
6158
|
-
function bufferToLowerCasedHeaderName(
|
|
6159
|
-
return tree.lookup(
|
|
6158
|
+
function bufferToLowerCasedHeaderName(value2) {
|
|
6159
|
+
return tree.lookup(value2) ?? value2.toString("latin1").toLowerCase();
|
|
6160
6160
|
}
|
|
6161
6161
|
function parseHeaders(headers, obj) {
|
|
6162
6162
|
if (obj === void 0) obj = {};
|
|
@@ -6269,14 +6269,14 @@ var require_util = __commonJS({
|
|
|
6269
6269
|
iterator = iterable[Symbol.asyncIterator]();
|
|
6270
6270
|
},
|
|
6271
6271
|
pull(controller) {
|
|
6272
|
-
return iterator.next().then(({ done, value }) => {
|
|
6272
|
+
return iterator.next().then(({ done, value: value2 }) => {
|
|
6273
6273
|
if (done) {
|
|
6274
6274
|
return queueMicrotask(() => {
|
|
6275
6275
|
controller.close();
|
|
6276
6276
|
controller.byobRequest?.respond(0);
|
|
6277
6277
|
});
|
|
6278
6278
|
} else {
|
|
6279
|
-
const buf = Buffer.isBuffer(
|
|
6279
|
+
const buf = Buffer.isBuffer(value2) ? value2 : Buffer.from(value2);
|
|
6280
6280
|
if (buf.byteLength) {
|
|
6281
6281
|
return controller.enqueue(new Uint8Array(buf));
|
|
6282
6282
|
} else {
|
|
@@ -7309,8 +7309,8 @@ var require_request = __commonJS({
|
|
|
7309
7309
|
this.endHandler = null;
|
|
7310
7310
|
}
|
|
7311
7311
|
}
|
|
7312
|
-
addHeader(key,
|
|
7313
|
-
processHeader(this, key,
|
|
7312
|
+
addHeader(key, value2) {
|
|
7313
|
+
processHeader(this, key, value2);
|
|
7314
7314
|
return this;
|
|
7315
7315
|
}
|
|
7316
7316
|
};
|
|
@@ -7382,11 +7382,11 @@ var require_request = __commonJS({
|
|
|
7382
7382
|
} else if (headerName === "transfer-encoding" || headerName === "keep-alive" || headerName === "upgrade") {
|
|
7383
7383
|
throw new InvalidArgumentError(`invalid ${headerName} header`);
|
|
7384
7384
|
} else if (headerName === "connection") {
|
|
7385
|
-
const
|
|
7386
|
-
if (
|
|
7385
|
+
const value2 = typeof val === "string" ? val : null;
|
|
7386
|
+
if (value2 === null) {
|
|
7387
7387
|
throw new InvalidArgumentError("invalid connection header");
|
|
7388
7388
|
}
|
|
7389
|
-
for (const token of
|
|
7389
|
+
for (const token of value2.toLowerCase().split(",")) {
|
|
7390
7390
|
const trimmed = token.trim();
|
|
7391
7391
|
if (!isValidHTTPToken(trimmed)) {
|
|
7392
7392
|
throw new InvalidArgumentError("invalid connection header");
|
|
@@ -7482,8 +7482,8 @@ var require_wrap_handler = __commonJS({
|
|
|
7482
7482
|
this.#handler.onError?.(err);
|
|
7483
7483
|
}
|
|
7484
7484
|
};
|
|
7485
|
-
function toRawHeaderValue(
|
|
7486
|
-
return Array.isArray(
|
|
7485
|
+
function toRawHeaderValue(value2) {
|
|
7486
|
+
return Array.isArray(value2) ? value2.map((item) => Buffer.from(item, "latin1")) : Buffer.from(value2, "latin1");
|
|
7487
7487
|
}
|
|
7488
7488
|
}
|
|
7489
7489
|
});
|
|
@@ -7680,9 +7680,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
7680
7680
|
}
|
|
7681
7681
|
close(callback) {
|
|
7682
7682
|
if (callback === void 0) {
|
|
7683
|
-
return new Promise((
|
|
7683
|
+
return new Promise((resolve2, reject) => {
|
|
7684
7684
|
this.close((err, data) => {
|
|
7685
|
-
return err ? reject(err) :
|
|
7685
|
+
return err ? reject(err) : resolve2(data);
|
|
7686
7686
|
});
|
|
7687
7687
|
});
|
|
7688
7688
|
}
|
|
@@ -7720,9 +7720,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
7720
7720
|
err = null;
|
|
7721
7721
|
}
|
|
7722
7722
|
if (callback === void 0) {
|
|
7723
|
-
return new Promise((
|
|
7723
|
+
return new Promise((resolve2, reject) => {
|
|
7724
7724
|
this.destroy(err, (err2, data) => {
|
|
7725
|
-
return err2 ? reject(err2) :
|
|
7725
|
+
return err2 ? reject(err2) : resolve2(data);
|
|
7726
7726
|
});
|
|
7727
7727
|
});
|
|
7728
7728
|
}
|
|
@@ -7920,8 +7920,8 @@ var require_utils = __commonJS({
|
|
|
7920
7920
|
function enumToMap(obj, filter = [], exceptions = []) {
|
|
7921
7921
|
const emptyFilter = (filter?.length ?? 0) === 0;
|
|
7922
7922
|
const emptyExceptions = (exceptions?.length ?? 0) === 0;
|
|
7923
|
-
return Object.fromEntries(Object.entries(obj).filter(([,
|
|
7924
|
-
return typeof
|
|
7923
|
+
return Object.fromEntries(Object.entries(obj).filter(([, value2]) => {
|
|
7924
|
+
return typeof value2 === "number" && (emptyFilter || filter.includes(value2)) && (emptyExceptions || !exceptions.includes(value2));
|
|
7925
7925
|
}));
|
|
7926
7926
|
}
|
|
7927
7927
|
}
|
|
@@ -8955,8 +8955,8 @@ var require_infra = __commonJS({
|
|
|
8955
8955
|
}
|
|
8956
8956
|
return lead === 0 && trail === str.length - 1 ? str : str.slice(lead, trail + 1);
|
|
8957
8957
|
}
|
|
8958
|
-
function serializeJavascriptValueToJSONString(
|
|
8959
|
-
const result = JSON.stringify(
|
|
8958
|
+
function serializeJavascriptValueToJSONString(value2) {
|
|
8959
|
+
const result = JSON.stringify(value2);
|
|
8960
8960
|
if (result === void 0) {
|
|
8961
8961
|
throw new TypeError("Value is not JSON serializable");
|
|
8962
8962
|
}
|
|
@@ -9154,11 +9154,11 @@ var require_data_url = __commonJS({
|
|
|
9154
9154
|
}
|
|
9155
9155
|
function collectAnHTTPQuotedString(input, position, extractValue = false) {
|
|
9156
9156
|
const positionStart = position.position;
|
|
9157
|
-
let
|
|
9157
|
+
let value2 = "";
|
|
9158
9158
|
assert(input[position.position] === '"');
|
|
9159
9159
|
position.position++;
|
|
9160
9160
|
while (true) {
|
|
9161
|
-
|
|
9161
|
+
value2 += collectASequenceOfCodePoints(
|
|
9162
9162
|
(char) => char !== '"' && char !== "\\",
|
|
9163
9163
|
input,
|
|
9164
9164
|
position
|
|
@@ -9170,10 +9170,10 @@ var require_data_url = __commonJS({
|
|
|
9170
9170
|
position.position++;
|
|
9171
9171
|
if (quoteOrBackslash === "\\") {
|
|
9172
9172
|
if (position.position >= input.length) {
|
|
9173
|
-
|
|
9173
|
+
value2 += "\\";
|
|
9174
9174
|
break;
|
|
9175
9175
|
}
|
|
9176
|
-
|
|
9176
|
+
value2 += input[position.position];
|
|
9177
9177
|
position.position++;
|
|
9178
9178
|
} else {
|
|
9179
9179
|
assert(quoteOrBackslash === '"');
|
|
@@ -9181,7 +9181,7 @@ var require_data_url = __commonJS({
|
|
|
9181
9181
|
}
|
|
9182
9182
|
}
|
|
9183
9183
|
if (extractValue) {
|
|
9184
|
-
return
|
|
9184
|
+
return value2;
|
|
9185
9185
|
}
|
|
9186
9186
|
return input.slice(positionStart, position.position);
|
|
9187
9187
|
}
|
|
@@ -9189,16 +9189,16 @@ var require_data_url = __commonJS({
|
|
|
9189
9189
|
assert(mimeType !== "failure");
|
|
9190
9190
|
const { parameters, essence } = mimeType;
|
|
9191
9191
|
let serialization = essence;
|
|
9192
|
-
for (let [name,
|
|
9192
|
+
for (let [name, value2] of parameters.entries()) {
|
|
9193
9193
|
serialization += ";";
|
|
9194
9194
|
serialization += name;
|
|
9195
9195
|
serialization += "=";
|
|
9196
|
-
if (!HTTP_TOKEN_CODEPOINTS.test(
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
|
|
9196
|
+
if (!HTTP_TOKEN_CODEPOINTS.test(value2)) {
|
|
9197
|
+
value2 = value2.replace(/[\\"]/ug, "\\$&");
|
|
9198
|
+
value2 = '"' + value2;
|
|
9199
|
+
value2 += '"';
|
|
9200
9200
|
}
|
|
9201
|
-
serialization +=
|
|
9201
|
+
serialization += value2;
|
|
9202
9202
|
}
|
|
9203
9203
|
return serialization;
|
|
9204
9204
|
}
|
|
@@ -9338,11 +9338,11 @@ var require_runtime_features = __commonJS({
|
|
|
9338
9338
|
* @param {Feature} feature
|
|
9339
9339
|
* @param {boolean} value
|
|
9340
9340
|
*/
|
|
9341
|
-
set(feature,
|
|
9341
|
+
set(feature, value2) {
|
|
9342
9342
|
if (features.includes(feature) === false) {
|
|
9343
9343
|
throw new TypeError(`unknown feature: ${feature}`);
|
|
9344
9344
|
}
|
|
9345
|
-
this.#map.set(feature,
|
|
9345
|
+
this.#map.set(feature, value2);
|
|
9346
9346
|
}
|
|
9347
9347
|
/**
|
|
9348
9348
|
* @param {Feature} feature
|
|
@@ -9599,11 +9599,11 @@ var require_webidl = __commonJS({
|
|
|
9599
9599
|
});
|
|
9600
9600
|
}
|
|
9601
9601
|
while (true) {
|
|
9602
|
-
const { done, value } = method.next();
|
|
9602
|
+
const { done, value: value2 } = method.next();
|
|
9603
9603
|
if (done) {
|
|
9604
9604
|
break;
|
|
9605
9605
|
}
|
|
9606
|
-
seq.push(converter(
|
|
9606
|
+
seq.push(converter(value2, prefix, `${argument}[${index++}]`));
|
|
9607
9607
|
}
|
|
9608
9608
|
return seq;
|
|
9609
9609
|
};
|
|
@@ -9670,20 +9670,20 @@ var require_webidl = __commonJS({
|
|
|
9670
9670
|
});
|
|
9671
9671
|
}
|
|
9672
9672
|
}
|
|
9673
|
-
let
|
|
9673
|
+
let value2 = dictionary?.[key];
|
|
9674
9674
|
const hasDefault = defaultValue !== void 0;
|
|
9675
|
-
if (hasDefault &&
|
|
9676
|
-
|
|
9675
|
+
if (hasDefault && value2 === void 0) {
|
|
9676
|
+
value2 = defaultValue();
|
|
9677
9677
|
}
|
|
9678
|
-
if (required || hasDefault ||
|
|
9679
|
-
|
|
9680
|
-
if (options.allowedValues && !options.allowedValues.includes(
|
|
9678
|
+
if (required || hasDefault || value2 !== void 0) {
|
|
9679
|
+
value2 = converter(value2, prefix, `${argument}.${key}`);
|
|
9680
|
+
if (options.allowedValues && !options.allowedValues.includes(value2)) {
|
|
9681
9681
|
throw webidl.errors.exception({
|
|
9682
9682
|
header: prefix,
|
|
9683
|
-
message: `${
|
|
9683
|
+
message: `${value2} is not an accepted type. Expected one of ${options.allowedValues.join(", ")}.`
|
|
9684
9684
|
});
|
|
9685
9685
|
}
|
|
9686
|
-
dict[key] =
|
|
9686
|
+
dict[key] = value2;
|
|
9687
9687
|
}
|
|
9688
9688
|
}
|
|
9689
9689
|
return dict;
|
|
@@ -9697,8 +9697,8 @@ var require_webidl = __commonJS({
|
|
|
9697
9697
|
return converter(V, prefix, argument);
|
|
9698
9698
|
};
|
|
9699
9699
|
};
|
|
9700
|
-
webidl.is.USVString = function(
|
|
9701
|
-
return typeof
|
|
9700
|
+
webidl.is.USVString = function(value2) {
|
|
9701
|
+
return typeof value2 === "string" && value2.isWellFormed();
|
|
9702
9702
|
};
|
|
9703
9703
|
webidl.is.ReadableStream = webidl.util.MakeTypeAssertion(ReadableStream);
|
|
9704
9704
|
webidl.is.Blob = webidl.util.MakeTypeAssertion(Blob);
|
|
@@ -9760,11 +9760,11 @@ var require_webidl = __commonJS({
|
|
|
9760
9760
|
}
|
|
9761
9761
|
return x;
|
|
9762
9762
|
};
|
|
9763
|
-
webidl.converters.USVString = function(
|
|
9764
|
-
if (typeof
|
|
9765
|
-
return
|
|
9763
|
+
webidl.converters.USVString = function(value2) {
|
|
9764
|
+
if (typeof value2 === "string") {
|
|
9765
|
+
return value2.toWellFormed();
|
|
9766
9766
|
}
|
|
9767
|
-
return `${
|
|
9767
|
+
return `${value2}`.toWellFormed();
|
|
9768
9768
|
};
|
|
9769
9769
|
webidl.converters.boolean = function(V) {
|
|
9770
9770
|
const x = Boolean(V);
|
|
@@ -10008,8 +10008,8 @@ var require_util2 = __commonJS({
|
|
|
10008
10008
|
}
|
|
10009
10009
|
return true;
|
|
10010
10010
|
}
|
|
10011
|
-
function normalizeBinaryStringToUtf8(
|
|
10012
|
-
return Buffer.from(
|
|
10011
|
+
function normalizeBinaryStringToUtf8(value2) {
|
|
10012
|
+
return Buffer.from(value2, "binary").toString("utf8");
|
|
10013
10013
|
}
|
|
10014
10014
|
function requestCurrentURL(request) {
|
|
10015
10015
|
return request.urlList[request.urlList.length - 1];
|
|
@@ -10330,7 +10330,7 @@ var require_util2 = __commonJS({
|
|
|
10330
10330
|
done: true
|
|
10331
10331
|
};
|
|
10332
10332
|
}
|
|
10333
|
-
const { [keyIndex]: key, [valueIndex]:
|
|
10333
|
+
const { [keyIndex]: key, [valueIndex]: value2 } = values[index];
|
|
10334
10334
|
this.#index = index + 1;
|
|
10335
10335
|
let result;
|
|
10336
10336
|
switch (this.#kind) {
|
|
@@ -10338,10 +10338,10 @@ var require_util2 = __commonJS({
|
|
|
10338
10338
|
result = key;
|
|
10339
10339
|
break;
|
|
10340
10340
|
case "value":
|
|
10341
|
-
result =
|
|
10341
|
+
result = value2;
|
|
10342
10342
|
break;
|
|
10343
10343
|
case "key+value":
|
|
10344
|
-
result = [key,
|
|
10344
|
+
result = [key, value2];
|
|
10345
10345
|
break;
|
|
10346
10346
|
}
|
|
10347
10347
|
return {
|
|
@@ -10407,8 +10407,8 @@ var require_util2 = __commonJS({
|
|
|
10407
10407
|
`Failed to execute 'forEach' on '${name}': parameter 1 is not of type 'Function'.`
|
|
10408
10408
|
);
|
|
10409
10409
|
}
|
|
10410
|
-
for (const { 0: key, 1:
|
|
10411
|
-
callbackfn.call(thisArg,
|
|
10410
|
+
for (const { 0: key, 1: value2 } of makeIterator(this, "key+value")) {
|
|
10411
|
+
callbackfn.call(thisArg, value2, key, this);
|
|
10412
10412
|
}
|
|
10413
10413
|
}
|
|
10414
10414
|
}
|
|
@@ -10477,8 +10477,8 @@ var require_util2 = __commonJS({
|
|
|
10477
10477
|
const protocol = url.protocol;
|
|
10478
10478
|
return protocol === "http:" || protocol === "https:";
|
|
10479
10479
|
}
|
|
10480
|
-
function simpleRangeHeaderValue(
|
|
10481
|
-
const data =
|
|
10480
|
+
function simpleRangeHeaderValue(value2, allowWhitespace) {
|
|
10481
|
+
const data = value2;
|
|
10482
10482
|
if (!data.startsWith("bytes")) {
|
|
10483
10483
|
return "failure";
|
|
10484
10484
|
}
|
|
@@ -10596,8 +10596,8 @@ var require_util2 = __commonJS({
|
|
|
10596
10596
|
if (values === null) {
|
|
10597
10597
|
return "failure";
|
|
10598
10598
|
}
|
|
10599
|
-
for (const
|
|
10600
|
-
const temporaryMimeType = parseMIMEType(
|
|
10599
|
+
for (const value2 of values) {
|
|
10600
|
+
const temporaryMimeType = parseMIMEType(value2);
|
|
10601
10601
|
if (temporaryMimeType === "failure" || temporaryMimeType.essence === "*/*") {
|
|
10602
10602
|
continue;
|
|
10603
10603
|
}
|
|
@@ -10617,8 +10617,8 @@ var require_util2 = __commonJS({
|
|
|
10617
10617
|
}
|
|
10618
10618
|
return mimeType;
|
|
10619
10619
|
}
|
|
10620
|
-
function gettingDecodingSplitting(
|
|
10621
|
-
const input =
|
|
10620
|
+
function gettingDecodingSplitting(value2) {
|
|
10621
|
+
const input = value2;
|
|
10622
10622
|
const position = { position: 0 };
|
|
10623
10623
|
const values = [];
|
|
10624
10624
|
let temporaryValue = "";
|
|
@@ -10649,11 +10649,11 @@ var require_util2 = __commonJS({
|
|
|
10649
10649
|
return values;
|
|
10650
10650
|
}
|
|
10651
10651
|
function getDecodeSplit(name, list) {
|
|
10652
|
-
const
|
|
10653
|
-
if (
|
|
10652
|
+
const value2 = list.get(name, true);
|
|
10653
|
+
if (value2 === null) {
|
|
10654
10654
|
return null;
|
|
10655
10655
|
}
|
|
10656
|
-
return gettingDecodingSplitting(
|
|
10656
|
+
return gettingDecodingSplitting(value2);
|
|
10657
10657
|
}
|
|
10658
10658
|
function hasAuthenticationEntry(request) {
|
|
10659
10659
|
return false;
|
|
@@ -10749,20 +10749,20 @@ var require_formdata = __commonJS({
|
|
|
10749
10749
|
});
|
|
10750
10750
|
}
|
|
10751
10751
|
}
|
|
10752
|
-
append(name,
|
|
10752
|
+
append(name, value2, filename = void 0) {
|
|
10753
10753
|
webidl.brandCheck(this, _FormData);
|
|
10754
10754
|
const prefix = "FormData.append";
|
|
10755
10755
|
webidl.argumentLengthCheck(arguments, 2, prefix);
|
|
10756
10756
|
name = webidl.converters.USVString(name);
|
|
10757
|
-
if (arguments.length === 3 || webidl.is.Blob(
|
|
10758
|
-
|
|
10757
|
+
if (arguments.length === 3 || webidl.is.Blob(value2)) {
|
|
10758
|
+
value2 = webidl.converters.Blob(value2, prefix, "value");
|
|
10759
10759
|
if (filename !== void 0) {
|
|
10760
10760
|
filename = webidl.converters.USVString(filename);
|
|
10761
10761
|
}
|
|
10762
10762
|
} else {
|
|
10763
|
-
|
|
10763
|
+
value2 = webidl.converters.USVString(value2);
|
|
10764
10764
|
}
|
|
10765
|
-
const entry = makeEntry(name,
|
|
10765
|
+
const entry = makeEntry(name, value2, filename);
|
|
10766
10766
|
this.#state.push(entry);
|
|
10767
10767
|
}
|
|
10768
10768
|
delete(name) {
|
|
@@ -10797,20 +10797,20 @@ var require_formdata = __commonJS({
|
|
|
10797
10797
|
name = webidl.converters.USVString(name);
|
|
10798
10798
|
return this.#state.findIndex((entry) => entry.name === name) !== -1;
|
|
10799
10799
|
}
|
|
10800
|
-
set(name,
|
|
10800
|
+
set(name, value2, filename = void 0) {
|
|
10801
10801
|
webidl.brandCheck(this, _FormData);
|
|
10802
10802
|
const prefix = "FormData.set";
|
|
10803
10803
|
webidl.argumentLengthCheck(arguments, 2, prefix);
|
|
10804
10804
|
name = webidl.converters.USVString(name);
|
|
10805
|
-
if (arguments.length === 3 || webidl.is.Blob(
|
|
10806
|
-
|
|
10805
|
+
if (arguments.length === 3 || webidl.is.Blob(value2)) {
|
|
10806
|
+
value2 = webidl.converters.Blob(value2, prefix, "value");
|
|
10807
10807
|
if (filename !== void 0) {
|
|
10808
10808
|
filename = webidl.converters.USVString(filename);
|
|
10809
10809
|
}
|
|
10810
10810
|
} else {
|
|
10811
|
-
|
|
10811
|
+
value2 = webidl.converters.USVString(value2);
|
|
10812
10812
|
}
|
|
10813
|
-
const entry = makeEntry(name,
|
|
10813
|
+
const entry = makeEntry(name, value2, filename);
|
|
10814
10814
|
const idx = this.#state.findIndex((entry2) => entry2.name === name);
|
|
10815
10815
|
if (idx !== -1) {
|
|
10816
10816
|
this.#state = [
|
|
@@ -10870,21 +10870,21 @@ var require_formdata = __commonJS({
|
|
|
10870
10870
|
configurable: true
|
|
10871
10871
|
}
|
|
10872
10872
|
});
|
|
10873
|
-
function makeEntry(name,
|
|
10874
|
-
if (typeof
|
|
10873
|
+
function makeEntry(name, value2, filename) {
|
|
10874
|
+
if (typeof value2 === "string") {
|
|
10875
10875
|
} else {
|
|
10876
|
-
if (!webidl.is.File(
|
|
10877
|
-
|
|
10876
|
+
if (!webidl.is.File(value2)) {
|
|
10877
|
+
value2 = new File([value2], "blob", { type: value2.type });
|
|
10878
10878
|
}
|
|
10879
10879
|
if (filename !== void 0) {
|
|
10880
10880
|
const options = {
|
|
10881
|
-
type:
|
|
10882
|
-
lastModified:
|
|
10881
|
+
type: value2.type,
|
|
10882
|
+
lastModified: value2.lastModified
|
|
10883
10883
|
};
|
|
10884
|
-
|
|
10884
|
+
value2 = new File([value2], filename, options);
|
|
10885
10885
|
}
|
|
10886
10886
|
}
|
|
10887
|
-
return { name, value };
|
|
10887
|
+
return { name, value: value2 };
|
|
10888
10888
|
}
|
|
10889
10889
|
webidl.is.FormData = webidl.util.MakeTypeAssertion(FormData);
|
|
10890
10890
|
module2.exports = { FormData, makeEntry, setFormDataState };
|
|
@@ -10972,19 +10972,19 @@ var require_formdata_parser = __commonJS({
|
|
|
10972
10972
|
} else {
|
|
10973
10973
|
position.position += 2;
|
|
10974
10974
|
}
|
|
10975
|
-
let
|
|
10975
|
+
let value2;
|
|
10976
10976
|
if (filename !== null) {
|
|
10977
10977
|
contentType ??= "text/plain";
|
|
10978
10978
|
if (!isAsciiString(contentType)) {
|
|
10979
10979
|
contentType = "";
|
|
10980
10980
|
}
|
|
10981
|
-
|
|
10981
|
+
value2 = new File([body], filename, { type: contentType });
|
|
10982
10982
|
} else {
|
|
10983
|
-
|
|
10983
|
+
value2 = decoderIgnoreBOM.decode(Buffer.from(body));
|
|
10984
10984
|
}
|
|
10985
10985
|
assert(webidl.is.USVString(name));
|
|
10986
|
-
assert(typeof
|
|
10987
|
-
entryList.push(makeEntry(name,
|
|
10986
|
+
assert(typeof value2 === "string" && webidl.is.USVString(value2) || webidl.is.File(value2));
|
|
10987
|
+
entryList.push(makeEntry(name, value2, filename));
|
|
10988
10988
|
}
|
|
10989
10989
|
}
|
|
10990
10990
|
function parseContentDispositionAttribute(input, position) {
|
|
@@ -11019,7 +11019,7 @@ var require_formdata_parser = __commonJS({
|
|
|
11019
11019
|
input,
|
|
11020
11020
|
position
|
|
11021
11021
|
);
|
|
11022
|
-
let
|
|
11022
|
+
let value2;
|
|
11023
11023
|
if (isExtended) {
|
|
11024
11024
|
const headerValue = collectASequenceOfBytes(
|
|
11025
11025
|
(char) => char !== 32 && char !== 13 && char !== 10 && char !== 59,
|
|
@@ -11034,7 +11034,7 @@ var require_formdata_parser = __commonJS({
|
|
|
11034
11034
|
headerValue[4] !== 56) {
|
|
11035
11035
|
throw parsingError("unknown encoding, expected utf-8''");
|
|
11036
11036
|
}
|
|
11037
|
-
|
|
11037
|
+
value2 = decodeURIComponent(decoder.decode(headerValue.subarray(7)));
|
|
11038
11038
|
} else if (input[position.position] === 34) {
|
|
11039
11039
|
position.position++;
|
|
11040
11040
|
const quotedValue = collectASequenceOfBytes(
|
|
@@ -11047,7 +11047,7 @@ var require_formdata_parser = __commonJS({
|
|
|
11047
11047
|
throw parsingError("Closing quote not found");
|
|
11048
11048
|
}
|
|
11049
11049
|
position.position++;
|
|
11050
|
-
|
|
11050
|
+
value2 = decoder.decode(quotedValue).replace(/%0A/ig, "\n").replace(/%0D/ig, "\r").replace(/%22/g, '"');
|
|
11051
11051
|
} else {
|
|
11052
11052
|
const tokenValue = collectASequenceOfBytes(
|
|
11053
11053
|
(char) => isToken(char) && char !== 59,
|
|
@@ -11055,9 +11055,9 @@ var require_formdata_parser = __commonJS({
|
|
|
11055
11055
|
input,
|
|
11056
11056
|
position
|
|
11057
11057
|
);
|
|
11058
|
-
|
|
11058
|
+
value2 = decoder.decode(tokenValue);
|
|
11059
11059
|
}
|
|
11060
|
-
return { name: attrNameStr, value, extended: isExtended };
|
|
11060
|
+
return { name: attrNameStr, value: value2, extended: isExtended };
|
|
11061
11061
|
}
|
|
11062
11062
|
function parseMultipartFormDataHeaders(input, position) {
|
|
11063
11063
|
let name = null;
|
|
@@ -11228,8 +11228,8 @@ var require_promise = __commonJS({
|
|
|
11228
11228
|
function createDeferredPromise() {
|
|
11229
11229
|
let res;
|
|
11230
11230
|
let rej;
|
|
11231
|
-
const promise = new Promise((
|
|
11232
|
-
res =
|
|
11231
|
+
const promise = new Promise((resolve2, reject) => {
|
|
11232
|
+
res = resolve2;
|
|
11233
11233
|
rej = reject;
|
|
11234
11234
|
});
|
|
11235
11235
|
return { promise, resolve: res, reject: rej };
|
|
@@ -11309,27 +11309,27 @@ var require_body = __commonJS({
|
|
|
11309
11309
|
const prefix = `--${boundary}\r
|
|
11310
11310
|
Content-Disposition: form-data`;
|
|
11311
11311
|
const formdataEscape = (str) => str.replace(/\n/g, "%0A").replace(/\r/g, "%0D").replace(/"/g, "%22");
|
|
11312
|
-
const normalizeLinefeeds = (
|
|
11312
|
+
const normalizeLinefeeds = (value2) => value2.replace(/\r?\n|\r/g, "\r\n");
|
|
11313
11313
|
const blobParts = [];
|
|
11314
11314
|
const rn = new Uint8Array([13, 10]);
|
|
11315
11315
|
length = 0;
|
|
11316
11316
|
let hasUnknownSizeValue = false;
|
|
11317
|
-
for (const [name,
|
|
11318
|
-
if (typeof
|
|
11317
|
+
for (const [name, value2] of object) {
|
|
11318
|
+
if (typeof value2 === "string") {
|
|
11319
11319
|
const chunk2 = textEncoder.encode(prefix + `; name="${formdataEscape(normalizeLinefeeds(name))}"\r
|
|
11320
11320
|
\r
|
|
11321
|
-
${normalizeLinefeeds(
|
|
11321
|
+
${normalizeLinefeeds(value2)}\r
|
|
11322
11322
|
`);
|
|
11323
11323
|
blobParts.push(chunk2);
|
|
11324
11324
|
length += chunk2.byteLength;
|
|
11325
11325
|
} else {
|
|
11326
|
-
const chunk2 = textEncoder.encode(`${prefix}; name="${formdataEscape(normalizeLinefeeds(name))}"` + (
|
|
11327
|
-
Content-Type: ${
|
|
11326
|
+
const chunk2 = textEncoder.encode(`${prefix}; name="${formdataEscape(normalizeLinefeeds(name))}"` + (value2.name ? `; filename="${formdataEscape(value2.name)}"` : "") + `\r
|
|
11327
|
+
Content-Type: ${value2.type || "application/octet-stream"}\r
|
|
11328
11328
|
\r
|
|
11329
11329
|
`);
|
|
11330
|
-
blobParts.push(chunk2,
|
|
11331
|
-
if (typeof
|
|
11332
|
-
length += chunk2.byteLength +
|
|
11330
|
+
blobParts.push(chunk2, value2, rn);
|
|
11331
|
+
if (typeof value2.size === "number") {
|
|
11332
|
+
length += chunk2.byteLength + value2.size + rn.byteLength;
|
|
11333
11333
|
} else {
|
|
11334
11334
|
hasUnknownSizeValue = true;
|
|
11335
11335
|
}
|
|
@@ -11438,21 +11438,21 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
11438
11438
|
return consumeBody(this, parseJSONFromBytes, instance, getInternalState);
|
|
11439
11439
|
},
|
|
11440
11440
|
formData() {
|
|
11441
|
-
return consumeBody(this, (
|
|
11441
|
+
return consumeBody(this, (value2) => {
|
|
11442
11442
|
const mimeType = bodyMimeType(getInternalState(this));
|
|
11443
11443
|
if (mimeType !== null) {
|
|
11444
11444
|
switch (mimeType.essence) {
|
|
11445
11445
|
case "multipart/form-data": {
|
|
11446
|
-
const parsed = multipartFormDataParser(
|
|
11446
|
+
const parsed = multipartFormDataParser(value2, mimeType);
|
|
11447
11447
|
const fd = new FormData();
|
|
11448
11448
|
setFormDataState(fd, parsed);
|
|
11449
11449
|
return fd;
|
|
11450
11450
|
}
|
|
11451
11451
|
case "application/x-www-form-urlencoded": {
|
|
11452
|
-
const entries = new URLSearchParams(
|
|
11452
|
+
const entries = new URLSearchParams(value2.toString());
|
|
11453
11453
|
const fd = new FormData();
|
|
11454
|
-
for (const [name,
|
|
11455
|
-
fd.append(name,
|
|
11454
|
+
for (const [name, value3] of entries) {
|
|
11455
|
+
fd.append(name, value3);
|
|
11456
11456
|
}
|
|
11457
11457
|
return fd;
|
|
11458
11458
|
}
|
|
@@ -12638,12 +12638,12 @@ upgrade: ${upgrade}\r
|
|
|
12638
12638
|
cb();
|
|
12639
12639
|
}
|
|
12640
12640
|
}
|
|
12641
|
-
const waitForDrain = () => new Promise((
|
|
12641
|
+
const waitForDrain = () => new Promise((resolve2, reject) => {
|
|
12642
12642
|
assert(callback === null);
|
|
12643
12643
|
if (socket[kError]) {
|
|
12644
12644
|
reject(socket[kError]);
|
|
12645
12645
|
} else {
|
|
12646
|
-
callback =
|
|
12646
|
+
callback = resolve2;
|
|
12647
12647
|
}
|
|
12648
12648
|
});
|
|
12649
12649
|
socket.on("close", onDrain).on("drain", onDrain);
|
|
@@ -12867,13 +12867,13 @@ var require_client_h2 = __commonJS({
|
|
|
12867
12867
|
} = http22;
|
|
12868
12868
|
function parseH2Headers(headers) {
|
|
12869
12869
|
const result = [];
|
|
12870
|
-
for (const [name,
|
|
12871
|
-
if (Array.isArray(
|
|
12872
|
-
for (const subvalue of
|
|
12870
|
+
for (const [name, value2] of Object.entries(headers)) {
|
|
12871
|
+
if (Array.isArray(value2)) {
|
|
12872
|
+
for (const subvalue of value2) {
|
|
12873
12873
|
result.push(Buffer.from(name), Buffer.from(subvalue));
|
|
12874
12874
|
}
|
|
12875
12875
|
} else {
|
|
12876
|
-
result.push(Buffer.from(name), Buffer.from(
|
|
12876
|
+
result.push(Buffer.from(name), Buffer.from(value2));
|
|
12877
12877
|
}
|
|
12878
12878
|
}
|
|
12879
12879
|
return result;
|
|
@@ -13527,12 +13527,12 @@ var require_client_h2 = __commonJS({
|
|
|
13527
13527
|
cb();
|
|
13528
13528
|
}
|
|
13529
13529
|
}
|
|
13530
|
-
const waitForDrain = () => new Promise((
|
|
13530
|
+
const waitForDrain = () => new Promise((resolve2, reject) => {
|
|
13531
13531
|
assert(callback === null);
|
|
13532
13532
|
if (socket[kError]) {
|
|
13533
13533
|
reject(socket[kError]);
|
|
13534
13534
|
} else {
|
|
13535
|
-
callback =
|
|
13535
|
+
callback = resolve2;
|
|
13536
13536
|
}
|
|
13537
13537
|
});
|
|
13538
13538
|
h2stream.on("close", onDrain).on("drain", onDrain);
|
|
@@ -13805,8 +13805,8 @@ var require_client = __commonJS({
|
|
|
13805
13805
|
get pipelining() {
|
|
13806
13806
|
return this[kPipelining];
|
|
13807
13807
|
}
|
|
13808
|
-
set pipelining(
|
|
13809
|
-
this[kPipelining] =
|
|
13808
|
+
set pipelining(value2) {
|
|
13809
|
+
this[kPipelining] = value2;
|
|
13810
13810
|
this[kResume](true);
|
|
13811
13811
|
}
|
|
13812
13812
|
get stats() {
|
|
@@ -13849,16 +13849,16 @@ var require_client = __commonJS({
|
|
|
13849
13849
|
return this[kNeedDrain] < 2;
|
|
13850
13850
|
}
|
|
13851
13851
|
[kClose]() {
|
|
13852
|
-
return new Promise((
|
|
13852
|
+
return new Promise((resolve2) => {
|
|
13853
13853
|
if (this[kSize]) {
|
|
13854
|
-
this[kClosedResolve] =
|
|
13854
|
+
this[kClosedResolve] = resolve2;
|
|
13855
13855
|
} else {
|
|
13856
|
-
|
|
13856
|
+
resolve2(null);
|
|
13857
13857
|
}
|
|
13858
13858
|
});
|
|
13859
13859
|
}
|
|
13860
13860
|
[kDestroy](err) {
|
|
13861
|
-
return new Promise((
|
|
13861
|
+
return new Promise((resolve2) => {
|
|
13862
13862
|
const requests = this[kQueue].splice(this[kPendingIdx]);
|
|
13863
13863
|
for (let i = 0; i < requests.length; i++) {
|
|
13864
13864
|
const request = requests[i];
|
|
@@ -13871,7 +13871,7 @@ var require_client = __commonJS({
|
|
|
13871
13871
|
this[kClosedResolve]();
|
|
13872
13872
|
this[kClosedResolve] = null;
|
|
13873
13873
|
}
|
|
13874
|
-
|
|
13874
|
+
resolve2(null);
|
|
13875
13875
|
};
|
|
13876
13876
|
if (this[kHTTPContext]) {
|
|
13877
13877
|
this[kHTTPContext].destroy(err, callback);
|
|
@@ -14278,8 +14278,8 @@ var require_pool_base = __commonJS({
|
|
|
14278
14278
|
}
|
|
14279
14279
|
return Promise.all(closeAll);
|
|
14280
14280
|
} else {
|
|
14281
|
-
return new Promise((
|
|
14282
|
-
this[kClosedResolve] =
|
|
14281
|
+
return new Promise((resolve2) => {
|
|
14282
|
+
this[kClosedResolve] = resolve2;
|
|
14283
14283
|
});
|
|
14284
14284
|
}
|
|
14285
14285
|
}
|
|
@@ -14961,8 +14961,8 @@ var require_socks5_utils = __commonJS({
|
|
|
14961
14961
|
}
|
|
14962
14962
|
const parts = [];
|
|
14963
14963
|
for (let i = 0; i < 8; i++) {
|
|
14964
|
-
const
|
|
14965
|
-
parts.push(
|
|
14964
|
+
const value2 = buffer.readUInt16BE(currentOffset + i * 2);
|
|
14965
|
+
parts.push(value2.toString(16));
|
|
14966
14966
|
}
|
|
14967
14967
|
address = parts.join(":");
|
|
14968
14968
|
currentOffset += 16;
|
|
@@ -15291,8 +15291,8 @@ var require_socks5_client = __commonJS({
|
|
|
15291
15291
|
} else if (addressType === ADDRESS_TYPES.IPV6) {
|
|
15292
15292
|
const parts = [];
|
|
15293
15293
|
for (let i = 0; i < 8; i++) {
|
|
15294
|
-
const
|
|
15295
|
-
parts.push(
|
|
15294
|
+
const value2 = this.buffer.readUInt16BE(offset + i * 2);
|
|
15295
|
+
parts.push(value2.toString(16));
|
|
15296
15296
|
}
|
|
15297
15297
|
boundAddress = parts.join(":");
|
|
15298
15298
|
offset += 16;
|
|
@@ -15401,7 +15401,7 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
15401
15401
|
const proxyHost = this[kProxyUrl].hostname;
|
|
15402
15402
|
const proxyPort = parseInt(this[kProxyUrl].port) || 1080;
|
|
15403
15403
|
debug("creating SOCKS5 connection to", proxyHost, proxyPort);
|
|
15404
|
-
const socket = await new Promise((
|
|
15404
|
+
const socket = await new Promise((resolve2, reject) => {
|
|
15405
15405
|
this[kConnector]({
|
|
15406
15406
|
hostname: proxyHost,
|
|
15407
15407
|
host: proxyHost,
|
|
@@ -15411,7 +15411,7 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
15411
15411
|
if (err) {
|
|
15412
15412
|
reject(err);
|
|
15413
15413
|
} else {
|
|
15414
|
-
|
|
15414
|
+
resolve2(socket2);
|
|
15415
15415
|
}
|
|
15416
15416
|
});
|
|
15417
15417
|
});
|
|
@@ -15421,14 +15421,14 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
15421
15421
|
socket.destroy();
|
|
15422
15422
|
});
|
|
15423
15423
|
await socks5Client.handshake();
|
|
15424
|
-
await new Promise((
|
|
15424
|
+
await new Promise((resolve2, reject) => {
|
|
15425
15425
|
const timeout = setTimeout(() => {
|
|
15426
15426
|
reject(new Error("SOCKS5 authentication timeout"));
|
|
15427
15427
|
}, 5e3);
|
|
15428
15428
|
const onAuthenticated = () => {
|
|
15429
15429
|
clearTimeout(timeout);
|
|
15430
15430
|
socks5Client.removeListener("error", onError);
|
|
15431
|
-
|
|
15431
|
+
resolve2();
|
|
15432
15432
|
};
|
|
15433
15433
|
const onError = (err) => {
|
|
15434
15434
|
clearTimeout(timeout);
|
|
@@ -15437,14 +15437,14 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
15437
15437
|
};
|
|
15438
15438
|
if (socks5Client.state === STATES.AUTHENTICATED) {
|
|
15439
15439
|
clearTimeout(timeout);
|
|
15440
|
-
|
|
15440
|
+
resolve2();
|
|
15441
15441
|
} else {
|
|
15442
15442
|
socks5Client.once("authenticated", onAuthenticated);
|
|
15443
15443
|
socks5Client.once("error", onError);
|
|
15444
15444
|
}
|
|
15445
15445
|
});
|
|
15446
15446
|
await socks5Client.connect(targetHost, targetPort);
|
|
15447
|
-
await new Promise((
|
|
15447
|
+
await new Promise((resolve2, reject) => {
|
|
15448
15448
|
const timeout = setTimeout(() => {
|
|
15449
15449
|
reject(new Error("SOCKS5 connection timeout"));
|
|
15450
15450
|
}, 5e3);
|
|
@@ -15452,7 +15452,7 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
15452
15452
|
debug("SOCKS5 tunnel established to", targetHost, targetPort, "via", info);
|
|
15453
15453
|
clearTimeout(timeout);
|
|
15454
15454
|
socks5Client.removeListener("error", onError);
|
|
15455
|
-
|
|
15455
|
+
resolve2();
|
|
15456
15456
|
};
|
|
15457
15457
|
const onError = (err) => {
|
|
15458
15458
|
clearTimeout(timeout);
|
|
@@ -15495,8 +15495,8 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
15495
15495
|
socket,
|
|
15496
15496
|
servername: this[kRequestTls]?.servername || targetHost
|
|
15497
15497
|
});
|
|
15498
|
-
await new Promise((
|
|
15499
|
-
finalSocket.once("secureConnect",
|
|
15498
|
+
await new Promise((resolve2, reject) => {
|
|
15499
|
+
finalSocket.once("secureConnect", resolve2);
|
|
15500
15500
|
finalSocket.once("error", reject);
|
|
15501
15501
|
});
|
|
15502
15502
|
}
|
|
@@ -15993,17 +15993,17 @@ var require_retry_handler = __commonJS({
|
|
|
15993
15993
|
get rawHeaders() {
|
|
15994
15994
|
return this.#target?.rawHeaders ?? null;
|
|
15995
15995
|
}
|
|
15996
|
-
set rawHeaders(
|
|
15996
|
+
set rawHeaders(value2) {
|
|
15997
15997
|
if (this.#target) {
|
|
15998
|
-
this.#target.rawHeaders =
|
|
15998
|
+
this.#target.rawHeaders = value2;
|
|
15999
15999
|
}
|
|
16000
16000
|
}
|
|
16001
16001
|
get rawTrailers() {
|
|
16002
16002
|
return this.#target?.rawTrailers ?? null;
|
|
16003
16003
|
}
|
|
16004
|
-
set rawTrailers(
|
|
16004
|
+
set rawTrailers(value2) {
|
|
16005
16005
|
if (this.#target) {
|
|
16006
|
-
this.#target.rawTrailers =
|
|
16006
|
+
this.#target.rawTrailers = value2;
|
|
16007
16007
|
}
|
|
16008
16008
|
}
|
|
16009
16009
|
};
|
|
@@ -16629,7 +16629,7 @@ var require_readable = __commonJS({
|
|
|
16629
16629
|
if (this._readableState.closeEmitted) {
|
|
16630
16630
|
return Promise.resolve(null);
|
|
16631
16631
|
}
|
|
16632
|
-
return new Promise((
|
|
16632
|
+
return new Promise((resolve2, reject) => {
|
|
16633
16633
|
if (this[kContentLength] && this[kContentLength] > limit || this[kBytesRead] > limit) {
|
|
16634
16634
|
this.destroy(new AbortError());
|
|
16635
16635
|
}
|
|
@@ -16643,11 +16643,11 @@ var require_readable = __commonJS({
|
|
|
16643
16643
|
if (signal.aborted) {
|
|
16644
16644
|
reject(signal.reason ?? new AbortError());
|
|
16645
16645
|
} else {
|
|
16646
|
-
|
|
16646
|
+
resolve2(null);
|
|
16647
16647
|
}
|
|
16648
16648
|
});
|
|
16649
16649
|
} else {
|
|
16650
|
-
this.on("close",
|
|
16650
|
+
this.on("close", resolve2);
|
|
16651
16651
|
}
|
|
16652
16652
|
this.on("error", noop).on("data", () => {
|
|
16653
16653
|
if (this[kBytesRead] > limit) {
|
|
@@ -16675,7 +16675,7 @@ var require_readable = __commonJS({
|
|
|
16675
16675
|
}
|
|
16676
16676
|
function consume(stream, type) {
|
|
16677
16677
|
assert(!stream[kConsume]);
|
|
16678
|
-
return new Promise((
|
|
16678
|
+
return new Promise((resolve2, reject) => {
|
|
16679
16679
|
if (isUnusable(stream)) {
|
|
16680
16680
|
const rState = stream._readableState;
|
|
16681
16681
|
if (rState.destroyed && rState.closeEmitted === false) {
|
|
@@ -16690,7 +16690,7 @@ var require_readable = __commonJS({
|
|
|
16690
16690
|
stream[kConsume] = {
|
|
16691
16691
|
type,
|
|
16692
16692
|
stream,
|
|
16693
|
-
resolve,
|
|
16693
|
+
resolve: resolve2,
|
|
16694
16694
|
reject,
|
|
16695
16695
|
length: 0,
|
|
16696
16696
|
body: []
|
|
@@ -16764,18 +16764,18 @@ var require_readable = __commonJS({
|
|
|
16764
16764
|
return buffer;
|
|
16765
16765
|
}
|
|
16766
16766
|
function consumeEnd(consume2, encoding) {
|
|
16767
|
-
const { type, body, resolve, stream, length } = consume2;
|
|
16767
|
+
const { type, body, resolve: resolve2, stream, length } = consume2;
|
|
16768
16768
|
try {
|
|
16769
16769
|
if (type === "text") {
|
|
16770
|
-
|
|
16770
|
+
resolve2(chunksDecode(body, length, encoding));
|
|
16771
16771
|
} else if (type === "json") {
|
|
16772
|
-
|
|
16772
|
+
resolve2(JSON.parse(chunksDecode(body, length, encoding)));
|
|
16773
16773
|
} else if (type === "arrayBuffer") {
|
|
16774
|
-
|
|
16774
|
+
resolve2(chunksConcat(body, length).buffer);
|
|
16775
16775
|
} else if (type === "blob") {
|
|
16776
|
-
|
|
16776
|
+
resolve2(new Blob(body, { type: stream[kContentType] }));
|
|
16777
16777
|
} else if (type === "bytes") {
|
|
16778
|
-
|
|
16778
|
+
resolve2(chunksConcat(body, length));
|
|
16779
16779
|
}
|
|
16780
16780
|
consumeFinish(consume2);
|
|
16781
16781
|
} catch (err) {
|
|
@@ -16965,9 +16965,9 @@ var require_api_request = __commonJS({
|
|
|
16965
16965
|
};
|
|
16966
16966
|
function request(opts, callback) {
|
|
16967
16967
|
if (callback === void 0) {
|
|
16968
|
-
return new Promise((
|
|
16968
|
+
return new Promise((resolve2, reject) => {
|
|
16969
16969
|
request.call(this, opts, (err, data) => {
|
|
16970
|
-
return err ? reject(err) :
|
|
16970
|
+
return err ? reject(err) : resolve2(data);
|
|
16971
16971
|
});
|
|
16972
16972
|
});
|
|
16973
16973
|
}
|
|
@@ -17179,9 +17179,9 @@ var require_api_stream = __commonJS({
|
|
|
17179
17179
|
};
|
|
17180
17180
|
function stream(opts, factory, callback) {
|
|
17181
17181
|
if (callback === void 0) {
|
|
17182
|
-
return new Promise((
|
|
17182
|
+
return new Promise((resolve2, reject) => {
|
|
17183
17183
|
stream.call(this, opts, factory, (err, data) => {
|
|
17184
|
-
return err ? reject(err) :
|
|
17184
|
+
return err ? reject(err) : resolve2(data);
|
|
17185
17185
|
});
|
|
17186
17186
|
});
|
|
17187
17187
|
}
|
|
@@ -17469,9 +17469,9 @@ var require_api_upgrade = __commonJS({
|
|
|
17469
17469
|
};
|
|
17470
17470
|
function upgrade(opts, callback) {
|
|
17471
17471
|
if (callback === void 0) {
|
|
17472
|
-
return new Promise((
|
|
17472
|
+
return new Promise((resolve2, reject) => {
|
|
17473
17473
|
upgrade.call(this, opts, (err, data) => {
|
|
17474
|
-
return err ? reject(err) :
|
|
17474
|
+
return err ? reject(err) : resolve2(data);
|
|
17475
17475
|
});
|
|
17476
17476
|
});
|
|
17477
17477
|
}
|
|
@@ -17564,9 +17564,9 @@ var require_api_connect = __commonJS({
|
|
|
17564
17564
|
};
|
|
17565
17565
|
function connect(opts, callback) {
|
|
17566
17566
|
if (callback === void 0) {
|
|
17567
|
-
return new Promise((
|
|
17567
|
+
return new Promise((resolve2, reject) => {
|
|
17568
17568
|
connect.call(this, opts, (err, data) => {
|
|
17569
|
-
return err ? reject(err) :
|
|
17569
|
+
return err ? reject(err) : resolve2(data);
|
|
17570
17570
|
});
|
|
17571
17571
|
});
|
|
17572
17572
|
}
|
|
@@ -17682,15 +17682,15 @@ var require_mock_utils = __commonJS({
|
|
|
17682
17682
|
}
|
|
17683
17683
|
} = require("node:util");
|
|
17684
17684
|
var { InvalidArgumentError } = require_errors();
|
|
17685
|
-
function matchValue(match,
|
|
17685
|
+
function matchValue(match, value2) {
|
|
17686
17686
|
if (typeof match === "string") {
|
|
17687
|
-
return match ===
|
|
17687
|
+
return match === value2;
|
|
17688
17688
|
}
|
|
17689
17689
|
if (match instanceof RegExp) {
|
|
17690
|
-
return match.test(
|
|
17690
|
+
return match.test(value2);
|
|
17691
17691
|
}
|
|
17692
17692
|
if (typeof match === "function") {
|
|
17693
|
-
return match(
|
|
17693
|
+
return match(value2) === true;
|
|
17694
17694
|
}
|
|
17695
17695
|
return false;
|
|
17696
17696
|
}
|
|
@@ -17750,21 +17750,21 @@ var require_mock_utils = __commonJS({
|
|
|
17750
17750
|
}
|
|
17751
17751
|
const originalQp = new URLSearchParams(query);
|
|
17752
17752
|
const normalizedQp = new URLSearchParams();
|
|
17753
|
-
for (let [key,
|
|
17753
|
+
for (let [key, value2] of originalQp.entries()) {
|
|
17754
17754
|
key = key.replace("[]", "");
|
|
17755
|
-
const valueRepresentsString = /^(['"]).*\1$/.test(
|
|
17755
|
+
const valueRepresentsString = /^(['"]).*\1$/.test(value2);
|
|
17756
17756
|
if (valueRepresentsString) {
|
|
17757
|
-
normalizedQp.append(key,
|
|
17757
|
+
normalizedQp.append(key, value2);
|
|
17758
17758
|
continue;
|
|
17759
17759
|
}
|
|
17760
|
-
if (
|
|
17761
|
-
const values =
|
|
17760
|
+
if (value2.includes(",")) {
|
|
17761
|
+
const values = value2.split(",");
|
|
17762
17762
|
for (const v of values) {
|
|
17763
17763
|
normalizedQp.append(key, v);
|
|
17764
17764
|
}
|
|
17765
17765
|
continue;
|
|
17766
17766
|
}
|
|
17767
|
-
normalizedQp.append(key,
|
|
17767
|
+
normalizedQp.append(key, value2);
|
|
17768
17768
|
}
|
|
17769
17769
|
return normalizedQp;
|
|
17770
17770
|
}
|
|
@@ -17870,14 +17870,14 @@ var require_mock_utils = __commonJS({
|
|
|
17870
17870
|
const result = [];
|
|
17871
17871
|
for (let i = 0; i < keys.length; ++i) {
|
|
17872
17872
|
const key = keys[i];
|
|
17873
|
-
const
|
|
17873
|
+
const value2 = data[key];
|
|
17874
17874
|
const name = Buffer.from(`${key}`);
|
|
17875
|
-
if (Array.isArray(
|
|
17876
|
-
for (let j = 0; j <
|
|
17877
|
-
result.push(name, Buffer.from(`${
|
|
17875
|
+
if (Array.isArray(value2)) {
|
|
17876
|
+
for (let j = 0; j < value2.length; ++j) {
|
|
17877
|
+
result.push(name, Buffer.from(`${value2[j]}`));
|
|
17878
17878
|
}
|
|
17879
17879
|
} else {
|
|
17880
|
-
result.push(name, Buffer.from(`${
|
|
17880
|
+
result.push(name, Buffer.from(`${value2}`));
|
|
17881
17881
|
}
|
|
17882
17882
|
}
|
|
17883
17883
|
return result;
|
|
@@ -18355,12 +18355,12 @@ var require_mock_call_history = __commonJS({
|
|
|
18355
18355
|
toString() {
|
|
18356
18356
|
const options = { betweenKeyValueSeparator: "->", betweenPairSeparator: "|" };
|
|
18357
18357
|
let result = "";
|
|
18358
|
-
this.toMap().forEach((
|
|
18359
|
-
if (typeof
|
|
18360
|
-
result = `${result}${key}${options.betweenKeyValueSeparator}${
|
|
18358
|
+
this.toMap().forEach((value2, key) => {
|
|
18359
|
+
if (typeof value2 === "string" || value2 === void 0 || value2 === null) {
|
|
18360
|
+
result = `${result}${key}${options.betweenKeyValueSeparator}${value2}${options.betweenPairSeparator}`;
|
|
18361
18361
|
}
|
|
18362
|
-
if (typeof
|
|
18363
|
-
result = `${result}${key}${options.betweenKeyValueSeparator}${JSON.stringify(
|
|
18362
|
+
if (typeof value2 === "object" && value2 !== null || Array.isArray(value2)) {
|
|
18363
|
+
result = `${result}${key}${options.betweenKeyValueSeparator}${JSON.stringify(value2)}${options.betweenPairSeparator}`;
|
|
18364
18364
|
}
|
|
18365
18365
|
});
|
|
18366
18366
|
return result.slice(0, -1);
|
|
@@ -18764,7 +18764,7 @@ var require_snapshot_utils = __commonJS({
|
|
|
18764
18764
|
};
|
|
18765
18765
|
}
|
|
18766
18766
|
var crypto2 = runtimeFeatures.has("crypto") ? require("node:crypto") : null;
|
|
18767
|
-
var hashId = crypto2?.hash ? (
|
|
18767
|
+
var hashId = crypto2?.hash ? (value2) => crypto2.hash("sha256", value2, "base64url") : (value2) => Buffer.from(value2).toString("base64url");
|
|
18768
18768
|
function isUndiciHeaders(headers) {
|
|
18769
18769
|
return Array.isArray(headers) && (headers.length & 1) === 0;
|
|
18770
18770
|
}
|
|
@@ -18797,19 +18797,19 @@ var require_snapshot_utils = __commonJS({
|
|
|
18797
18797
|
if (isUndiciHeaders(headers)) {
|
|
18798
18798
|
for (let i = 0; i < headers.length; i += 2) {
|
|
18799
18799
|
const key = headers[i];
|
|
18800
|
-
const
|
|
18801
|
-
if (key &&
|
|
18800
|
+
const value2 = headers[i + 1];
|
|
18801
|
+
if (key && value2 !== void 0) {
|
|
18802
18802
|
const keyStr = Buffer.isBuffer(key) ? key.toString() : key;
|
|
18803
|
-
const valueStr = Buffer.isBuffer(
|
|
18803
|
+
const valueStr = Buffer.isBuffer(value2) ? value2.toString() : value2;
|
|
18804
18804
|
normalizedHeaders[keyStr.toLowerCase()] = valueStr;
|
|
18805
18805
|
}
|
|
18806
18806
|
}
|
|
18807
18807
|
return normalizedHeaders;
|
|
18808
18808
|
}
|
|
18809
18809
|
if (headers && typeof headers === "object") {
|
|
18810
|
-
for (const [key,
|
|
18810
|
+
for (const [key, value2] of Object.entries(headers)) {
|
|
18811
18811
|
if (key && typeof key === "string") {
|
|
18812
|
-
normalizedHeaders[key.toLowerCase()] = Array.isArray(
|
|
18812
|
+
normalizedHeaders[key.toLowerCase()] = Array.isArray(value2) ? value2.join(", ") : String(value2);
|
|
18813
18813
|
}
|
|
18814
18814
|
}
|
|
18815
18815
|
}
|
|
@@ -18840,7 +18840,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
18840
18840
|
"../../node_modules/.pnpm/undici@7.30.1/node_modules/undici/lib/mock/snapshot-recorder.js"(exports2, module2) {
|
|
18841
18841
|
"use strict";
|
|
18842
18842
|
var { writeFile: writeFile2, readFile: readFile2, mkdir: mkdir2 } = require("node:fs/promises");
|
|
18843
|
-
var { dirname:
|
|
18843
|
+
var { dirname: dirname3, resolve: resolve2 } = require("node:path");
|
|
18844
18844
|
var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = require("node:timers");
|
|
18845
18845
|
var { InvalidArgumentError, UndiciError } = require_errors();
|
|
18846
18846
|
var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -18864,14 +18864,14 @@ var require_snapshot_recorder = __commonJS({
|
|
|
18864
18864
|
} = matchOptions;
|
|
18865
18865
|
const filtered = {};
|
|
18866
18866
|
const { ignore, exclude, match } = headerFilters;
|
|
18867
|
-
for (const [key,
|
|
18867
|
+
for (const [key, value2] of Object.entries(headers)) {
|
|
18868
18868
|
const headerKey = caseSensitive ? key : key.toLowerCase();
|
|
18869
18869
|
if (exclude.has(headerKey)) continue;
|
|
18870
18870
|
if (ignore.has(headerKey)) continue;
|
|
18871
18871
|
if (match.size !== 0) {
|
|
18872
18872
|
if (!match.has(headerKey)) continue;
|
|
18873
18873
|
}
|
|
18874
|
-
filtered[headerKey] =
|
|
18874
|
+
filtered[headerKey] = value2;
|
|
18875
18875
|
}
|
|
18876
18876
|
return filtered;
|
|
18877
18877
|
}
|
|
@@ -18882,10 +18882,10 @@ var require_snapshot_recorder = __commonJS({
|
|
|
18882
18882
|
} = matchOptions;
|
|
18883
18883
|
const filtered = {};
|
|
18884
18884
|
const { exclude: excludeSet } = headerFilters;
|
|
18885
|
-
for (const [key,
|
|
18885
|
+
for (const [key, value2] of Object.entries(headers)) {
|
|
18886
18886
|
const headerKey = caseSensitive ? key : key.toLowerCase();
|
|
18887
18887
|
if (excludeSet.has(headerKey)) continue;
|
|
18888
|
-
filtered[headerKey] =
|
|
18888
|
+
filtered[headerKey] = value2;
|
|
18889
18889
|
}
|
|
18890
18890
|
return filtered;
|
|
18891
18891
|
}
|
|
@@ -18899,8 +18899,8 @@ var require_snapshot_recorder = __commonJS({
|
|
|
18899
18899
|
for (const key of headerKeys) {
|
|
18900
18900
|
const values = Array.isArray(formattedRequest.headers[key]) ? formattedRequest.headers[key] : [formattedRequest.headers[key]];
|
|
18901
18901
|
parts.push(key);
|
|
18902
|
-
for (const
|
|
18903
|
-
parts.push(String(
|
|
18902
|
+
for (const value2 of values.sort()) {
|
|
18903
|
+
parts.push(String(value2));
|
|
18904
18904
|
}
|
|
18905
18905
|
}
|
|
18906
18906
|
}
|
|
@@ -19041,7 +19041,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
19041
19041
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
19042
19042
|
}
|
|
19043
19043
|
try {
|
|
19044
|
-
const data = await readFile2(
|
|
19044
|
+
const data = await readFile2(resolve2(path), "utf8");
|
|
19045
19045
|
const parsed = JSON.parse(data);
|
|
19046
19046
|
if (Array.isArray(parsed)) {
|
|
19047
19047
|
this.#snapshots.clear();
|
|
@@ -19070,8 +19070,8 @@ var require_snapshot_recorder = __commonJS({
|
|
|
19070
19070
|
if (!path) {
|
|
19071
19071
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
19072
19072
|
}
|
|
19073
|
-
const resolvedPath =
|
|
19074
|
-
await mkdir2(
|
|
19073
|
+
const resolvedPath = resolve2(path);
|
|
19074
|
+
await mkdir2(dirname3(resolvedPath), { recursive: true });
|
|
19075
19075
|
const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
|
|
19076
19076
|
hash,
|
|
19077
19077
|
snapshot
|
|
@@ -19759,9 +19759,9 @@ var require_redirect_handler = __commonJS({
|
|
|
19759
19759
|
}
|
|
19760
19760
|
} else if (headers && typeof headers === "object") {
|
|
19761
19761
|
const entries = util.hasSafeIterator(headers) ? headers : Object.entries(headers);
|
|
19762
|
-
for (const [key,
|
|
19762
|
+
for (const [key, value2] of entries) {
|
|
19763
19763
|
if (!shouldRemoveHeader(key, removeContent, unknownOrigin)) {
|
|
19764
|
-
ret.push(key,
|
|
19764
|
+
ret.push(key, value2);
|
|
19765
19765
|
}
|
|
19766
19766
|
}
|
|
19767
19767
|
} else {
|
|
@@ -20431,65 +20431,65 @@ var require_cache = __commonJS({
|
|
|
20431
20431
|
var MAX_DELTA_SECONDS = 2147483647;
|
|
20432
20432
|
var RESTRICTIVE_DIRECTIVE_NAMES = ["no-store", "private", "no-cache"];
|
|
20433
20433
|
var kInvalidCacheControlDirectives = /* @__PURE__ */ Symbol("invalid cache-control directives");
|
|
20434
|
-
function trimOWS(
|
|
20435
|
-
return
|
|
20434
|
+
function trimOWS(value2) {
|
|
20435
|
+
return value2.replace(/^[\t ]+|[\t ]+$/g, "");
|
|
20436
20436
|
}
|
|
20437
|
-
function arrayIncludes(array,
|
|
20437
|
+
function arrayIncludes(array, value2) {
|
|
20438
20438
|
for (let i = 0; i < array.length; i++) {
|
|
20439
|
-
if (array[i] ===
|
|
20439
|
+
if (array[i] === value2) {
|
|
20440
20440
|
return true;
|
|
20441
20441
|
}
|
|
20442
20442
|
}
|
|
20443
20443
|
return false;
|
|
20444
20444
|
}
|
|
20445
|
-
function trimOWSStart(
|
|
20446
|
-
return
|
|
20445
|
+
function trimOWSStart(value2) {
|
|
20446
|
+
return value2.replace(/^[\t ]+/, "");
|
|
20447
20447
|
}
|
|
20448
|
-
function trimOWSEnd(
|
|
20449
|
-
return
|
|
20448
|
+
function trimOWSEnd(value2) {
|
|
20449
|
+
return value2.replace(/[\t ]+$/, "");
|
|
20450
20450
|
}
|
|
20451
|
-
function findUnescapedQuote(
|
|
20451
|
+
function findUnescapedQuote(value2, start) {
|
|
20452
20452
|
let escaped = false;
|
|
20453
|
-
for (let i = start; i <
|
|
20453
|
+
for (let i = start; i < value2.length; i++) {
|
|
20454
20454
|
if (escaped) {
|
|
20455
20455
|
escaped = false;
|
|
20456
|
-
} else if (
|
|
20456
|
+
} else if (value2[i] === "\\") {
|
|
20457
20457
|
escaped = true;
|
|
20458
|
-
} else if (
|
|
20458
|
+
} else if (value2[i] === '"') {
|
|
20459
20459
|
return i;
|
|
20460
20460
|
}
|
|
20461
20461
|
}
|
|
20462
20462
|
return -1;
|
|
20463
20463
|
}
|
|
20464
|
-
function splitCacheControlHeaderValue(
|
|
20464
|
+
function splitCacheControlHeaderValue(value2) {
|
|
20465
20465
|
const directives = [];
|
|
20466
20466
|
let start = 0;
|
|
20467
20467
|
let quoteStart = -1;
|
|
20468
20468
|
let inQuote = false;
|
|
20469
20469
|
let escaped = false;
|
|
20470
|
-
for (let i = 0; i <
|
|
20470
|
+
for (let i = 0; i < value2.length; i++) {
|
|
20471
20471
|
if (inQuote) {
|
|
20472
20472
|
if (escaped) {
|
|
20473
20473
|
escaped = false;
|
|
20474
|
-
} else if (
|
|
20474
|
+
} else if (value2[i] === "\\") {
|
|
20475
20475
|
escaped = true;
|
|
20476
|
-
} else if (
|
|
20476
|
+
} else if (value2[i] === '"') {
|
|
20477
20477
|
inQuote = false;
|
|
20478
20478
|
quoteStart = -1;
|
|
20479
20479
|
}
|
|
20480
|
-
} else if (
|
|
20480
|
+
} else if (value2[i] === '"') {
|
|
20481
20481
|
inQuote = true;
|
|
20482
20482
|
quoteStart = i;
|
|
20483
|
-
} else if (
|
|
20484
|
-
directives.push({ value:
|
|
20483
|
+
} else if (value2[i] === ",") {
|
|
20484
|
+
directives.push({ value: value2.substring(start, i), fromMalformedQuote: false });
|
|
20485
20485
|
start = i + 1;
|
|
20486
20486
|
}
|
|
20487
20487
|
}
|
|
20488
20488
|
if (!inQuote) {
|
|
20489
|
-
directives.push({ value:
|
|
20489
|
+
directives.push({ value: value2.substring(start), fromMalformedQuote: false });
|
|
20490
20490
|
return directives;
|
|
20491
20491
|
}
|
|
20492
|
-
const tail =
|
|
20492
|
+
const tail = value2.substring(start);
|
|
20493
20493
|
const quoteOffset = quoteStart - start;
|
|
20494
20494
|
let tailStart = 0;
|
|
20495
20495
|
for (let i = 0; i < tail.length; i++) {
|
|
@@ -20606,26 +20606,26 @@ var require_cache = __commonJS({
|
|
|
20606
20606
|
throw new TypeError(`expected headers to be object, got ${typeof key}`);
|
|
20607
20607
|
}
|
|
20608
20608
|
}
|
|
20609
|
-
function assertCacheValue(
|
|
20610
|
-
if (typeof
|
|
20611
|
-
throw new TypeError(`expected value to be object, got ${typeof
|
|
20609
|
+
function assertCacheValue(value2) {
|
|
20610
|
+
if (typeof value2 !== "object") {
|
|
20611
|
+
throw new TypeError(`expected value to be object, got ${typeof value2}`);
|
|
20612
20612
|
}
|
|
20613
20613
|
for (const property of ["statusCode", "cachedAt", "staleAt", "deleteAt"]) {
|
|
20614
|
-
if (typeof
|
|
20615
|
-
throw new TypeError(`expected value.${property} to be number, got ${typeof
|
|
20614
|
+
if (typeof value2[property] !== "number") {
|
|
20615
|
+
throw new TypeError(`expected value.${property} to be number, got ${typeof value2[property]}`);
|
|
20616
20616
|
}
|
|
20617
20617
|
}
|
|
20618
|
-
if (typeof
|
|
20619
|
-
throw new TypeError(`expected value.statusMessage to be string, got ${typeof
|
|
20618
|
+
if (typeof value2.statusMessage !== "string") {
|
|
20619
|
+
throw new TypeError(`expected value.statusMessage to be string, got ${typeof value2.statusMessage}`);
|
|
20620
20620
|
}
|
|
20621
|
-
if (
|
|
20622
|
-
throw new TypeError(`expected value.rawHeaders to be object, got ${typeof
|
|
20621
|
+
if (value2.headers != null && typeof value2.headers !== "object") {
|
|
20622
|
+
throw new TypeError(`expected value.rawHeaders to be object, got ${typeof value2.headers}`);
|
|
20623
20623
|
}
|
|
20624
|
-
if (
|
|
20625
|
-
throw new TypeError(`expected value.vary to be object, got ${typeof
|
|
20624
|
+
if (value2.vary !== void 0 && typeof value2.vary !== "object") {
|
|
20625
|
+
throw new TypeError(`expected value.vary to be object, got ${typeof value2.vary}`);
|
|
20626
20626
|
}
|
|
20627
|
-
if (
|
|
20628
|
-
throw new TypeError(`expected value.etag to be string, got ${typeof
|
|
20627
|
+
if (value2.etag !== void 0 && typeof value2.etag !== "string") {
|
|
20628
|
+
throw new TypeError(`expected value.etag to be string, got ${typeof value2.etag}`);
|
|
20629
20629
|
}
|
|
20630
20630
|
}
|
|
20631
20631
|
function parseCacheControlHeader(header) {
|
|
@@ -20639,7 +20639,7 @@ var require_cache = __commonJS({
|
|
|
20639
20639
|
const fromMalformedQuote = directiveRecord.fromMalformedQuote;
|
|
20640
20640
|
const keyValueDelimiter = directive.indexOf("=");
|
|
20641
20641
|
let key;
|
|
20642
|
-
let
|
|
20642
|
+
let value2;
|
|
20643
20643
|
let keyHasTrailingWhitespace = false;
|
|
20644
20644
|
let valueHasLeadingWhitespace = false;
|
|
20645
20645
|
if (keyValueDelimiter !== -1) {
|
|
@@ -20648,7 +20648,7 @@ var require_cache = __commonJS({
|
|
|
20648
20648
|
keyHasTrailingWhitespace = trimOWSEnd(rawKey) !== rawKey;
|
|
20649
20649
|
valueHasLeadingWhitespace = trimOWSStart(rawValue) !== rawValue;
|
|
20650
20650
|
key = trimOWS(rawKey);
|
|
20651
|
-
|
|
20651
|
+
value2 = trimOWSStart(rawValue);
|
|
20652
20652
|
} else {
|
|
20653
20653
|
key = trimOWS(directive);
|
|
20654
20654
|
}
|
|
@@ -20667,22 +20667,22 @@ var require_cache = __commonJS({
|
|
|
20667
20667
|
if (fromMalformedQuote || invalidNumericDirectives.has(key)) {
|
|
20668
20668
|
continue;
|
|
20669
20669
|
}
|
|
20670
|
-
if (
|
|
20670
|
+
if (value2 === void 0 || keyHasTrailingWhitespace || valueHasLeadingWhitespace) {
|
|
20671
20671
|
delete output[key];
|
|
20672
20672
|
invalidNumericDirectives.add(key);
|
|
20673
20673
|
markInvalidCacheControlDirective(output, key);
|
|
20674
20674
|
continue;
|
|
20675
20675
|
}
|
|
20676
|
-
if (
|
|
20677
|
-
|
|
20676
|
+
if (value2.length >= 2 && value2[0] === '"' && value2[value2.length - 1] === '"') {
|
|
20677
|
+
value2 = value2.substring(1, value2.length - 1);
|
|
20678
20678
|
}
|
|
20679
|
-
if (!/^[0-9]+$/.test(
|
|
20679
|
+
if (!/^[0-9]+$/.test(value2)) {
|
|
20680
20680
|
delete output[key];
|
|
20681
20681
|
invalidNumericDirectives.add(key);
|
|
20682
20682
|
markInvalidCacheControlDirective(output, key);
|
|
20683
20683
|
continue;
|
|
20684
20684
|
}
|
|
20685
|
-
const parsedValue = Math.min(parseInt(
|
|
20685
|
+
const parsedValue = Math.min(parseInt(value2, 10), MAX_DELTA_SECONDS);
|
|
20686
20686
|
if (key === "min-fresh") {
|
|
20687
20687
|
if (!(key in output) || output[key] < parsedValue) {
|
|
20688
20688
|
output[key] = parsedValue;
|
|
@@ -20698,22 +20698,22 @@ var require_cache = __commonJS({
|
|
|
20698
20698
|
output[key] = true;
|
|
20699
20699
|
break;
|
|
20700
20700
|
}
|
|
20701
|
-
if (
|
|
20701
|
+
if (value2 !== void 0 && value2.length === 0) {
|
|
20702
20702
|
output[key] = true;
|
|
20703
20703
|
break;
|
|
20704
20704
|
}
|
|
20705
|
-
if (
|
|
20706
|
-
if (
|
|
20707
|
-
|
|
20705
|
+
if (value2) {
|
|
20706
|
+
if (value2[0] === '"') {
|
|
20707
|
+
value2 = trimOWSEnd(value2);
|
|
20708
20708
|
let fieldList = "";
|
|
20709
20709
|
let lastQuotedPart = i;
|
|
20710
20710
|
let foundEndingQuote = false;
|
|
20711
|
-
const closingQuote = findUnescapedQuote(
|
|
20711
|
+
const closingQuote = findUnescapedQuote(value2, 1);
|
|
20712
20712
|
if (closingQuote !== -1) {
|
|
20713
|
-
fieldList =
|
|
20713
|
+
fieldList = value2.substring(1, closingQuote);
|
|
20714
20714
|
foundEndingQuote = true;
|
|
20715
20715
|
} else {
|
|
20716
|
-
const fieldListParts = [
|
|
20716
|
+
const fieldListParts = [value2.substring(1)];
|
|
20717
20717
|
for (let j = i + 1; j < directives.length; j++) {
|
|
20718
20718
|
const nextPart = trimOWS(directives[j].value);
|
|
20719
20719
|
const closingQuote2 = findUnescapedQuote(nextPart, 0);
|
|
@@ -20750,7 +20750,7 @@ var require_cache = __commonJS({
|
|
|
20750
20750
|
}
|
|
20751
20751
|
}
|
|
20752
20752
|
} else {
|
|
20753
|
-
const fieldName = trimOWS(
|
|
20753
|
+
const fieldName = trimOWS(value2);
|
|
20754
20754
|
if (!isValidHTTPToken(fieldName)) {
|
|
20755
20755
|
output[key] = true;
|
|
20756
20756
|
} else if (output[key] !== true) {
|
|
@@ -20775,7 +20775,7 @@ var require_cache = __commonJS({
|
|
|
20775
20775
|
if (fromMalformedQuote || invalidNoArgumentDirectives.has(key)) {
|
|
20776
20776
|
continue;
|
|
20777
20777
|
}
|
|
20778
|
-
if (
|
|
20778
|
+
if (value2 !== void 0) {
|
|
20779
20779
|
delete output[key];
|
|
20780
20780
|
invalidNoArgumentDirectives.add(key);
|
|
20781
20781
|
continue;
|
|
@@ -21444,12 +21444,12 @@ var require_cache_handler = __commonJS({
|
|
|
21444
21444
|
206
|
|
21445
21445
|
];
|
|
21446
21446
|
var MAX_RESPONSE_AGE = 2147483647e3;
|
|
21447
|
-
function trimOWS(
|
|
21448
|
-
return
|
|
21447
|
+
function trimOWS(value2) {
|
|
21448
|
+
return value2.replace(/^[\t ]+|[\t ]+$/g, "");
|
|
21449
21449
|
}
|
|
21450
|
-
function arrayIncludes(array,
|
|
21450
|
+
function arrayIncludes(array, value2) {
|
|
21451
21451
|
for (let i = 0; i < array.length; i++) {
|
|
21452
|
-
if (array[i] ===
|
|
21452
|
+
if (array[i] === value2) {
|
|
21453
21453
|
return true;
|
|
21454
21454
|
}
|
|
21455
21455
|
}
|
|
@@ -21657,7 +21657,7 @@ var require_cache_handler = __commonJS({
|
|
|
21657
21657
|
const cachedAt = baseTime;
|
|
21658
21658
|
const deleteAt = determineDeleteAt(baseTime, now, cacheControlDirectives, absoluteStaleAt);
|
|
21659
21659
|
const strippedHeaders = stripNecessaryHeaders(resHeaders, cacheControlDirectives);
|
|
21660
|
-
const
|
|
21660
|
+
const value2 = {
|
|
21661
21661
|
statusCode,
|
|
21662
21662
|
statusMessage,
|
|
21663
21663
|
headers: strippedHeaders,
|
|
@@ -21672,13 +21672,13 @@ var require_cache_handler = __commonJS({
|
|
|
21672
21672
|
if (!cachedValue) {
|
|
21673
21673
|
return downstreamOnHeaders();
|
|
21674
21674
|
}
|
|
21675
|
-
|
|
21676
|
-
|
|
21677
|
-
|
|
21678
|
-
|
|
21679
|
-
|
|
21675
|
+
value2.statusCode = cachedValue.statusCode;
|
|
21676
|
+
value2.statusMessage = cachedValue.statusMessage;
|
|
21677
|
+
value2.etag = cachedValue.etag;
|
|
21678
|
+
value2.vary = varyDirectives ?? cachedValue.vary;
|
|
21679
|
+
value2.headers = { ...cachedValue.headers, ...strippedHeaders };
|
|
21680
21680
|
downstreamOnHeaders();
|
|
21681
|
-
this.#writeStream = this.#store.createWriteStream(this.#cacheKey,
|
|
21681
|
+
this.#writeStream = this.#store.createWriteStream(this.#cacheKey, value2);
|
|
21682
21682
|
if (!this.#writeStream || !cachedValue?.body) {
|
|
21683
21683
|
return;
|
|
21684
21684
|
}
|
|
@@ -21732,9 +21732,9 @@ var require_cache_handler = __commonJS({
|
|
|
21732
21732
|
}
|
|
21733
21733
|
} else {
|
|
21734
21734
|
if (typeof resHeaders.etag === "string" && isEtagUsable(resHeaders.etag)) {
|
|
21735
|
-
|
|
21735
|
+
value2.etag = resHeaders.etag;
|
|
21736
21736
|
}
|
|
21737
|
-
this.#writeStream = this.#store.createWriteStream(this.#cacheKey,
|
|
21737
|
+
this.#writeStream = this.#store.createWriteStream(this.#cacheKey, value2);
|
|
21738
21738
|
if (!this.#writeStream) {
|
|
21739
21739
|
return downstreamOnHeaders();
|
|
21740
21740
|
}
|
|
@@ -22278,12 +22278,12 @@ var require_cache2 = __commonJS({
|
|
|
22278
22278
|
}
|
|
22279
22279
|
var nop = () => {
|
|
22280
22280
|
};
|
|
22281
|
-
function trimOWS(
|
|
22282
|
-
return
|
|
22281
|
+
function trimOWS(value2) {
|
|
22282
|
+
return value2.replace(/^[\t ]+|[\t ]+$/g, "");
|
|
22283
22283
|
}
|
|
22284
|
-
function arrayIncludes(array,
|
|
22284
|
+
function arrayIncludes(array, value2) {
|
|
22285
22285
|
for (let i = 0; i < array.length; i++) {
|
|
22286
|
-
if (array[i] ===
|
|
22286
|
+
if (array[i] === value2) {
|
|
22287
22287
|
return true;
|
|
22288
22288
|
}
|
|
22289
22289
|
}
|
|
@@ -22296,11 +22296,11 @@ var require_cache2 = __commonJS({
|
|
|
22296
22296
|
}
|
|
22297
22297
|
const values = Array.isArray(pragma) ? pragma : [pragma];
|
|
22298
22298
|
for (let i = 0; i < values.length; i++) {
|
|
22299
|
-
const
|
|
22300
|
-
if (typeof
|
|
22299
|
+
const value2 = values[i];
|
|
22300
|
+
if (typeof value2 !== "string") {
|
|
22301
22301
|
continue;
|
|
22302
22302
|
}
|
|
22303
|
-
const directives =
|
|
22303
|
+
const directives = value2.split(",");
|
|
22304
22304
|
for (let j = 0; j < directives.length; j++) {
|
|
22305
22305
|
if (trimOWS(directives[j]).toLowerCase() === "no-cache") {
|
|
22306
22306
|
return true;
|
|
@@ -22719,17 +22719,17 @@ var require_decompress = __commonJS({
|
|
|
22719
22719
|
get rawHeaders() {
|
|
22720
22720
|
return this.target?.rawHeaders ?? null;
|
|
22721
22721
|
}
|
|
22722
|
-
set rawHeaders(
|
|
22722
|
+
set rawHeaders(value2) {
|
|
22723
22723
|
if (this.target) {
|
|
22724
|
-
this.target.rawHeaders =
|
|
22724
|
+
this.target.rawHeaders = value2;
|
|
22725
22725
|
}
|
|
22726
22726
|
}
|
|
22727
22727
|
get rawTrailers() {
|
|
22728
22728
|
return this.target?.rawTrailers ?? null;
|
|
22729
22729
|
}
|
|
22730
|
-
set rawTrailers(
|
|
22730
|
+
set rawTrailers(value2) {
|
|
22731
22731
|
if (this.target) {
|
|
22732
|
-
this.target.rawTrailers =
|
|
22732
|
+
this.target.rawTrailers = value2;
|
|
22733
22733
|
}
|
|
22734
22734
|
}
|
|
22735
22735
|
};
|
|
@@ -23800,28 +23800,28 @@ var require_sqlite_cache_store = __commonJS({
|
|
|
23800
23800
|
*/
|
|
23801
23801
|
get(key) {
|
|
23802
23802
|
assertCacheKey(key);
|
|
23803
|
-
const
|
|
23804
|
-
return
|
|
23805
|
-
body:
|
|
23806
|
-
statusCode:
|
|
23807
|
-
statusMessage:
|
|
23808
|
-
headers:
|
|
23809
|
-
etag:
|
|
23810
|
-
vary:
|
|
23811
|
-
cacheControlDirectives:
|
|
23812
|
-
cachedAt:
|
|
23813
|
-
staleAt:
|
|
23814
|
-
deleteAt:
|
|
23803
|
+
const value2 = this.#findValue(key);
|
|
23804
|
+
return value2 ? {
|
|
23805
|
+
body: value2.body ? Buffer.from(value2.body.buffer, value2.body.byteOffset, value2.body.byteLength) : void 0,
|
|
23806
|
+
statusCode: value2.statusCode,
|
|
23807
|
+
statusMessage: value2.statusMessage,
|
|
23808
|
+
headers: value2.headers ? JSON.parse(value2.headers) : void 0,
|
|
23809
|
+
etag: value2.etag ? value2.etag : void 0,
|
|
23810
|
+
vary: value2.vary ? JSON.parse(value2.vary) : void 0,
|
|
23811
|
+
cacheControlDirectives: value2.cacheControlDirectives ? JSON.parse(value2.cacheControlDirectives) : void 0,
|
|
23812
|
+
cachedAt: value2.cachedAt,
|
|
23813
|
+
staleAt: value2.staleAt,
|
|
23814
|
+
deleteAt: value2.deleteAt
|
|
23815
23815
|
} : void 0;
|
|
23816
23816
|
}
|
|
23817
23817
|
/**
|
|
23818
23818
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheKey} key
|
|
23819
23819
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheValue & { body: null | Buffer | Array<Buffer>}} value
|
|
23820
23820
|
*/
|
|
23821
|
-
set(key,
|
|
23821
|
+
set(key, value2) {
|
|
23822
23822
|
assertCacheKey(key);
|
|
23823
23823
|
const url = this.#makeValueUrl(key);
|
|
23824
|
-
const body = Array.isArray(
|
|
23824
|
+
const body = Array.isArray(value2.body) ? Buffer.concat(value2.body) : value2.body;
|
|
23825
23825
|
const size = body?.byteLength;
|
|
23826
23826
|
if (size && size > this.#maxEntrySize) {
|
|
23827
23827
|
return;
|
|
@@ -23830,14 +23830,14 @@ var require_sqlite_cache_store = __commonJS({
|
|
|
23830
23830
|
if (existingValue) {
|
|
23831
23831
|
this.#updateValueQuery.run(
|
|
23832
23832
|
body,
|
|
23833
|
-
|
|
23834
|
-
|
|
23835
|
-
|
|
23836
|
-
|
|
23837
|
-
|
|
23838
|
-
|
|
23839
|
-
|
|
23840
|
-
|
|
23833
|
+
value2.deleteAt,
|
|
23834
|
+
value2.statusCode,
|
|
23835
|
+
value2.statusMessage,
|
|
23836
|
+
value2.headers ? JSON.stringify(value2.headers) : null,
|
|
23837
|
+
value2.etag ? value2.etag : null,
|
|
23838
|
+
value2.cacheControlDirectives ? JSON.stringify(value2.cacheControlDirectives) : null,
|
|
23839
|
+
value2.cachedAt,
|
|
23840
|
+
value2.staleAt,
|
|
23841
23841
|
existingValue.id
|
|
23842
23842
|
);
|
|
23843
23843
|
} else {
|
|
@@ -23845,15 +23845,15 @@ var require_sqlite_cache_store = __commonJS({
|
|
|
23845
23845
|
url,
|
|
23846
23846
|
key.method,
|
|
23847
23847
|
body,
|
|
23848
|
-
|
|
23849
|
-
|
|
23850
|
-
|
|
23851
|
-
|
|
23852
|
-
|
|
23853
|
-
|
|
23854
|
-
|
|
23855
|
-
|
|
23856
|
-
|
|
23848
|
+
value2.deleteAt,
|
|
23849
|
+
value2.statusCode,
|
|
23850
|
+
value2.statusMessage,
|
|
23851
|
+
value2.headers ? JSON.stringify(value2.headers) : null,
|
|
23852
|
+
value2.etag ? value2.etag : null,
|
|
23853
|
+
value2.cacheControlDirectives ? JSON.stringify(value2.cacheControlDirectives) : null,
|
|
23854
|
+
value2.vary ? JSON.stringify(value2.vary) : null,
|
|
23855
|
+
value2.cachedAt,
|
|
23856
|
+
value2.staleAt
|
|
23857
23857
|
);
|
|
23858
23858
|
this.#prune();
|
|
23859
23859
|
}
|
|
@@ -23863,9 +23863,9 @@ var require_sqlite_cache_store = __commonJS({
|
|
|
23863
23863
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheValue} value
|
|
23864
23864
|
* @returns {Writable | undefined}
|
|
23865
23865
|
*/
|
|
23866
|
-
createWriteStream(key,
|
|
23866
|
+
createWriteStream(key, value2) {
|
|
23867
23867
|
assertCacheKey(key);
|
|
23868
|
-
assertCacheValue(
|
|
23868
|
+
assertCacheValue(value2);
|
|
23869
23869
|
let size = 0;
|
|
23870
23870
|
const body = [];
|
|
23871
23871
|
const store = this;
|
|
@@ -23881,7 +23881,7 @@ var require_sqlite_cache_store = __commonJS({
|
|
|
23881
23881
|
callback();
|
|
23882
23882
|
},
|
|
23883
23883
|
final(callback) {
|
|
23884
|
-
store.set(key, { ...
|
|
23884
|
+
store.set(key, { ...value2, body });
|
|
23885
23885
|
callback();
|
|
23886
23886
|
}
|
|
23887
23887
|
});
|
|
@@ -23941,13 +23941,13 @@ var require_sqlite_cache_store = __commonJS({
|
|
|
23941
23941
|
return void 0;
|
|
23942
23942
|
}
|
|
23943
23943
|
const now = Date.now();
|
|
23944
|
-
for (const
|
|
23945
|
-
if (now >=
|
|
23944
|
+
for (const value2 of values) {
|
|
23945
|
+
if (now >= value2.deleteAt && !canBeExpired) {
|
|
23946
23946
|
continue;
|
|
23947
23947
|
}
|
|
23948
23948
|
let matches = true;
|
|
23949
|
-
if (
|
|
23950
|
-
const vary = JSON.parse(
|
|
23949
|
+
if (value2.vary) {
|
|
23950
|
+
const vary = JSON.parse(value2.vary);
|
|
23951
23951
|
for (const header in vary) {
|
|
23952
23952
|
if (!headerValueEquals(headers[header], vary[header])) {
|
|
23953
23953
|
matches = false;
|
|
@@ -23956,7 +23956,7 @@ var require_sqlite_cache_store = __commonJS({
|
|
|
23956
23956
|
}
|
|
23957
23957
|
}
|
|
23958
23958
|
if (matches) {
|
|
23959
|
-
return
|
|
23959
|
+
return value2;
|
|
23960
23960
|
}
|
|
23961
23961
|
}
|
|
23962
23962
|
return void 0;
|
|
@@ -24034,25 +24034,25 @@ var require_headers = __commonJS({
|
|
|
24034
24034
|
});
|
|
24035
24035
|
}
|
|
24036
24036
|
}
|
|
24037
|
-
function appendHeader(headers, name,
|
|
24038
|
-
|
|
24037
|
+
function appendHeader(headers, name, value2) {
|
|
24038
|
+
value2 = headerValueNormalize(value2);
|
|
24039
24039
|
if (!isValidHeaderName(name)) {
|
|
24040
24040
|
throw webidl.errors.invalidArgument({
|
|
24041
24041
|
prefix: "Headers.append",
|
|
24042
24042
|
value: name,
|
|
24043
24043
|
type: "header name"
|
|
24044
24044
|
});
|
|
24045
|
-
} else if (!isValidHeaderValue(
|
|
24045
|
+
} else if (!isValidHeaderValue(value2)) {
|
|
24046
24046
|
throw webidl.errors.invalidArgument({
|
|
24047
24047
|
prefix: "Headers.append",
|
|
24048
|
-
value,
|
|
24048
|
+
value: value2,
|
|
24049
24049
|
type: "header value"
|
|
24050
24050
|
});
|
|
24051
24051
|
}
|
|
24052
24052
|
if (getHeadersGuard(headers) === "immutable") {
|
|
24053
24053
|
throw new TypeError("immutable");
|
|
24054
24054
|
}
|
|
24055
|
-
return getHeadersList(headers).append(name,
|
|
24055
|
+
return getHeadersList(headers).append(name, value2, false);
|
|
24056
24056
|
}
|
|
24057
24057
|
function headersListSortAndCombine(target) {
|
|
24058
24058
|
const headersList = getHeadersList(target);
|
|
@@ -24069,13 +24069,13 @@ var require_headers = __commonJS({
|
|
|
24069
24069
|
return headersList.sortedMap = names;
|
|
24070
24070
|
}
|
|
24071
24071
|
for (let i = 0; i < names.length; ++i) {
|
|
24072
|
-
const { 0: name, 1:
|
|
24072
|
+
const { 0: name, 1: value2 } = names[i];
|
|
24073
24073
|
if (name === "set-cookie") {
|
|
24074
24074
|
for (let j = 0; j < cookies.length; ++j) {
|
|
24075
24075
|
headers.push([name, cookies[j]]);
|
|
24076
24076
|
}
|
|
24077
24077
|
} else {
|
|
24078
|
-
headers.push([name,
|
|
24078
|
+
headers.push([name, value2]);
|
|
24079
24079
|
}
|
|
24080
24080
|
}
|
|
24081
24081
|
return headersList.sortedMap = headers;
|
|
@@ -24117,7 +24117,7 @@ var require_headers = __commonJS({
|
|
|
24117
24117
|
* @param {string} value
|
|
24118
24118
|
* @param {boolean} isLowerCase
|
|
24119
24119
|
*/
|
|
24120
|
-
append(name,
|
|
24120
|
+
append(name, value2, isLowerCase) {
|
|
24121
24121
|
this.sortedMap = null;
|
|
24122
24122
|
const lowercaseName = isLowerCase ? name : name.toLowerCase();
|
|
24123
24123
|
const exists = this.headersMap.get(lowercaseName);
|
|
@@ -24125,13 +24125,13 @@ var require_headers = __commonJS({
|
|
|
24125
24125
|
const delimiter = lowercaseName === "cookie" ? "; " : ", ";
|
|
24126
24126
|
this.headersMap.set(lowercaseName, {
|
|
24127
24127
|
name: exists.name,
|
|
24128
|
-
value: `${exists.value}${delimiter}${
|
|
24128
|
+
value: `${exists.value}${delimiter}${value2}`
|
|
24129
24129
|
});
|
|
24130
24130
|
} else {
|
|
24131
|
-
this.headersMap.set(lowercaseName, { name, value });
|
|
24131
|
+
this.headersMap.set(lowercaseName, { name, value: value2 });
|
|
24132
24132
|
}
|
|
24133
24133
|
if (lowercaseName === "set-cookie") {
|
|
24134
|
-
(this.cookies ??= []).push(
|
|
24134
|
+
(this.cookies ??= []).push(value2);
|
|
24135
24135
|
}
|
|
24136
24136
|
}
|
|
24137
24137
|
/**
|
|
@@ -24140,13 +24140,13 @@ var require_headers = __commonJS({
|
|
|
24140
24140
|
* @param {string} value
|
|
24141
24141
|
* @param {boolean} isLowerCase
|
|
24142
24142
|
*/
|
|
24143
|
-
set(name,
|
|
24143
|
+
set(name, value2, isLowerCase) {
|
|
24144
24144
|
this.sortedMap = null;
|
|
24145
24145
|
const lowercaseName = isLowerCase ? name : name.toLowerCase();
|
|
24146
24146
|
if (lowercaseName === "set-cookie") {
|
|
24147
|
-
this.cookies = [
|
|
24147
|
+
this.cookies = [value2];
|
|
24148
24148
|
}
|
|
24149
|
-
this.headersMap.set(lowercaseName, { name, value });
|
|
24149
|
+
this.headersMap.set(lowercaseName, { name, value: value2 });
|
|
24150
24150
|
}
|
|
24151
24151
|
/**
|
|
24152
24152
|
* @see https://fetch.spec.whatwg.org/#concept-header-list-delete
|
|
@@ -24171,15 +24171,15 @@ var require_headers = __commonJS({
|
|
|
24171
24171
|
return this.headersMap.get(isLowerCase ? name : name.toLowerCase())?.value ?? null;
|
|
24172
24172
|
}
|
|
24173
24173
|
*[Symbol.iterator]() {
|
|
24174
|
-
for (const { 0: name, 1: { value } } of this.headersMap) {
|
|
24175
|
-
yield [name,
|
|
24174
|
+
for (const { 0: name, 1: { value: value2 } } of this.headersMap) {
|
|
24175
|
+
yield [name, value2];
|
|
24176
24176
|
}
|
|
24177
24177
|
}
|
|
24178
24178
|
get entries() {
|
|
24179
24179
|
const headers = {};
|
|
24180
24180
|
if (this.headersMap.size !== 0) {
|
|
24181
|
-
for (const { name, value } of this.headersMap.values()) {
|
|
24182
|
-
headers[name] =
|
|
24181
|
+
for (const { name, value: value2 } of this.headersMap.values()) {
|
|
24182
|
+
headers[name] = value2;
|
|
24183
24183
|
}
|
|
24184
24184
|
}
|
|
24185
24185
|
return headers;
|
|
@@ -24190,13 +24190,13 @@ var require_headers = __commonJS({
|
|
|
24190
24190
|
get entriesList() {
|
|
24191
24191
|
const headers = [];
|
|
24192
24192
|
if (this.headersMap.size !== 0) {
|
|
24193
|
-
for (const { 0: lowerName, 1: { name, value } } of this.headersMap) {
|
|
24193
|
+
for (const { 0: lowerName, 1: { name, value: value2 } } of this.headersMap) {
|
|
24194
24194
|
if (lowerName === "set-cookie") {
|
|
24195
24195
|
for (const cookie of this.cookies) {
|
|
24196
24196
|
headers.push([name, cookie]);
|
|
24197
24197
|
}
|
|
24198
24198
|
} else {
|
|
24199
|
-
headers.push([name,
|
|
24199
|
+
headers.push([name, value2]);
|
|
24200
24200
|
}
|
|
24201
24201
|
}
|
|
24202
24202
|
}
|
|
@@ -24214,9 +24214,9 @@ var require_headers = __commonJS({
|
|
|
24214
24214
|
const firstValue = iterator.next().value;
|
|
24215
24215
|
array[0] = [firstValue[0], firstValue[1].value];
|
|
24216
24216
|
assert(firstValue[1].value !== null);
|
|
24217
|
-
for (let i = 1, j = 0, right = 0, left = 0, pivot = 0, x,
|
|
24218
|
-
|
|
24219
|
-
x = array[i] = [
|
|
24217
|
+
for (let i = 1, j = 0, right = 0, left = 0, pivot = 0, x, value2; i < size; ++i) {
|
|
24218
|
+
value2 = iterator.next().value;
|
|
24219
|
+
x = array[i] = [value2[0], value2[1].value];
|
|
24220
24220
|
assert(x[1] !== null);
|
|
24221
24221
|
left = 0;
|
|
24222
24222
|
right = i;
|
|
@@ -24242,9 +24242,9 @@ var require_headers = __commonJS({
|
|
|
24242
24242
|
return array;
|
|
24243
24243
|
} else {
|
|
24244
24244
|
let i = 0;
|
|
24245
|
-
for (const { 0: name, 1: { value } } of this.headersMap) {
|
|
24246
|
-
array[i++] = [name,
|
|
24247
|
-
assert(
|
|
24245
|
+
for (const { 0: name, 1: { value: value2 } } of this.headersMap) {
|
|
24246
|
+
array[i++] = [name, value2];
|
|
24247
|
+
assert(value2 !== null);
|
|
24248
24248
|
}
|
|
24249
24249
|
return array.sort(compareHeaderName);
|
|
24250
24250
|
}
|
|
@@ -24273,13 +24273,13 @@ var require_headers = __commonJS({
|
|
|
24273
24273
|
}
|
|
24274
24274
|
}
|
|
24275
24275
|
// https://fetch.spec.whatwg.org/#dom-headers-append
|
|
24276
|
-
append(name,
|
|
24276
|
+
append(name, value2) {
|
|
24277
24277
|
webidl.brandCheck(this, _Headers);
|
|
24278
24278
|
webidl.argumentLengthCheck(arguments, 2, "Headers.append");
|
|
24279
24279
|
const prefix = "Headers.append";
|
|
24280
24280
|
name = webidl.converters.ByteString(name, prefix, "name");
|
|
24281
|
-
|
|
24282
|
-
return appendHeader(this, name,
|
|
24281
|
+
value2 = webidl.converters.ByteString(value2, prefix, "value");
|
|
24282
|
+
return appendHeader(this, name, value2);
|
|
24283
24283
|
}
|
|
24284
24284
|
// https://fetch.spec.whatwg.org/#dom-headers-delete
|
|
24285
24285
|
delete(name) {
|
|
@@ -24333,30 +24333,30 @@ var require_headers = __commonJS({
|
|
|
24333
24333
|
return this.#headersList.contains(name, false);
|
|
24334
24334
|
}
|
|
24335
24335
|
// https://fetch.spec.whatwg.org/#dom-headers-set
|
|
24336
|
-
set(name,
|
|
24336
|
+
set(name, value2) {
|
|
24337
24337
|
webidl.brandCheck(this, _Headers);
|
|
24338
24338
|
webidl.argumentLengthCheck(arguments, 2, "Headers.set");
|
|
24339
24339
|
const prefix = "Headers.set";
|
|
24340
24340
|
name = webidl.converters.ByteString(name, prefix, "name");
|
|
24341
|
-
|
|
24342
|
-
|
|
24341
|
+
value2 = webidl.converters.ByteString(value2, prefix, "value");
|
|
24342
|
+
value2 = headerValueNormalize(value2);
|
|
24343
24343
|
if (!isValidHeaderName(name)) {
|
|
24344
24344
|
throw webidl.errors.invalidArgument({
|
|
24345
24345
|
prefix,
|
|
24346
24346
|
value: name,
|
|
24347
24347
|
type: "header name"
|
|
24348
24348
|
});
|
|
24349
|
-
} else if (!isValidHeaderValue(
|
|
24349
|
+
} else if (!isValidHeaderValue(value2)) {
|
|
24350
24350
|
throw webidl.errors.invalidArgument({
|
|
24351
24351
|
prefix,
|
|
24352
|
-
value,
|
|
24352
|
+
value: value2,
|
|
24353
24353
|
type: "header value"
|
|
24354
24354
|
});
|
|
24355
24355
|
}
|
|
24356
24356
|
if (this.#guard === "immutable") {
|
|
24357
24357
|
throw new TypeError("immutable");
|
|
24358
24358
|
}
|
|
24359
|
-
this.#headersList.set(name,
|
|
24359
|
+
this.#headersList.set(name, value2, false);
|
|
24360
24360
|
}
|
|
24361
24361
|
// https://fetch.spec.whatwg.org/#dom-headers-getsetcookie
|
|
24362
24362
|
getSetCookie() {
|
|
@@ -24511,8 +24511,8 @@ var require_response = __commonJS({
|
|
|
24511
24511
|
}
|
|
24512
24512
|
const responseObject = fromInnerResponse(makeResponse({}), "immutable");
|
|
24513
24513
|
responseObject.#state.status = status;
|
|
24514
|
-
const
|
|
24515
|
-
responseObject.#state.headersList.append("location",
|
|
24514
|
+
const value2 = isomorphicEncode(URLSerializer(parsedURL));
|
|
24515
|
+
responseObject.#state.headersList.append("location", value2, true);
|
|
24516
24516
|
return responseObject;
|
|
24517
24517
|
}
|
|
24518
24518
|
// https://fetch.spec.whatwg.org/#dom-response
|
|
@@ -24725,9 +24725,9 @@ var require_response = __commonJS({
|
|
|
24725
24725
|
get(target, p) {
|
|
24726
24726
|
return p in state ? state[p] : target[p];
|
|
24727
24727
|
},
|
|
24728
|
-
set(target, p,
|
|
24728
|
+
set(target, p, value2) {
|
|
24729
24729
|
assert(!(p in state));
|
|
24730
|
-
target[p] =
|
|
24730
|
+
target[p] = value2;
|
|
24731
24731
|
return true;
|
|
24732
24732
|
}
|
|
24733
24733
|
});
|
|
@@ -25158,8 +25158,8 @@ var require_request2 = __commonJS({
|
|
|
25158
25158
|
const headers = init.headers !== void 0 ? init.headers : new HeadersList(headersList);
|
|
25159
25159
|
headersList.clear();
|
|
25160
25160
|
if (headers instanceof HeadersList) {
|
|
25161
|
-
for (const { name, value } of headers.rawValues()) {
|
|
25162
|
-
headersList.append(name,
|
|
25161
|
+
for (const { name, value: value2 } of headers.rawValues()) {
|
|
25162
|
+
headersList.append(name, value2, false);
|
|
25163
25163
|
}
|
|
25164
25164
|
headersList.cookies = headers.cookies;
|
|
25165
25165
|
} else {
|
|
@@ -26039,8 +26039,8 @@ var require_fetch = __commonJS({
|
|
|
26039
26039
|
}
|
|
26040
26040
|
}
|
|
26041
26041
|
if (!request.headersList.contains("accept", true)) {
|
|
26042
|
-
const
|
|
26043
|
-
request.headersList.append("accept",
|
|
26042
|
+
const value2 = "*/*";
|
|
26043
|
+
request.headersList.append("accept", value2, true);
|
|
26044
26044
|
}
|
|
26045
26045
|
if (!request.headersList.contains("accept-language", true)) {
|
|
26046
26046
|
request.headersList.append("accept-language", "*", true);
|
|
@@ -26661,11 +26661,11 @@ var require_fetch = __commonJS({
|
|
|
26661
26661
|
let bytes;
|
|
26662
26662
|
let isFailure;
|
|
26663
26663
|
try {
|
|
26664
|
-
const { done, value } = await fetchParams.controller.next();
|
|
26664
|
+
const { done, value: value2 } = await fetchParams.controller.next();
|
|
26665
26665
|
if (isAborted(fetchParams)) {
|
|
26666
26666
|
break;
|
|
26667
26667
|
}
|
|
26668
|
-
bytes = done ? void 0 :
|
|
26668
|
+
bytes = done ? void 0 : value2;
|
|
26669
26669
|
} catch (err) {
|
|
26670
26670
|
if (fetchParams.controller.ended && !timingInfo.encodedBodySize) {
|
|
26671
26671
|
bytes = void 0;
|
|
@@ -26720,7 +26720,7 @@ var require_fetch = __commonJS({
|
|
|
26720
26720
|
const agent = fetchParams.controller.dispatcher;
|
|
26721
26721
|
const path = url.pathname + url.search;
|
|
26722
26722
|
const hasTrailingQuestionMark = url.search.length === 0 && url.href[url.href.length - url.hash.length - 1] === "?";
|
|
26723
|
-
return new Promise((
|
|
26723
|
+
return new Promise((resolve2, reject) => agent.dispatch(
|
|
26724
26724
|
{
|
|
26725
26725
|
path: hasTrailingQuestionMark ? `${path}?` : path,
|
|
26726
26726
|
origin: url.origin,
|
|
@@ -26754,13 +26754,13 @@ var require_fetch = __commonJS({
|
|
|
26754
26754
|
const headersList = new HeadersList();
|
|
26755
26755
|
for (let i = 0; i < rawHeaders.length; i += 2) {
|
|
26756
26756
|
const nameStr = bufferToLowerCasedHeaderName(rawHeaders[i]);
|
|
26757
|
-
const
|
|
26758
|
-
if (Array.isArray(
|
|
26759
|
-
for (const val of
|
|
26757
|
+
const value2 = rawHeaders[i + 1];
|
|
26758
|
+
if (Array.isArray(value2) && !Buffer.isBuffer(rawHeaders[i + 1])) {
|
|
26759
|
+
for (const val of value2) {
|
|
26760
26760
|
headersList.append(nameStr, val.toString("latin1"), true);
|
|
26761
26761
|
}
|
|
26762
26762
|
} else {
|
|
26763
|
-
headersList.append(nameStr,
|
|
26763
|
+
headersList.append(nameStr, value2.toString("latin1"), true);
|
|
26764
26764
|
}
|
|
26765
26765
|
}
|
|
26766
26766
|
const location = headersList.get("location", true);
|
|
@@ -26808,7 +26808,7 @@ var require_fetch = __commonJS({
|
|
|
26808
26808
|
}
|
|
26809
26809
|
this.body = new Readable({ read: resume });
|
|
26810
26810
|
const onError = this.onError.bind(this);
|
|
26811
|
-
|
|
26811
|
+
resolve2({
|
|
26812
26812
|
status,
|
|
26813
26813
|
statusText,
|
|
26814
26814
|
headersList,
|
|
@@ -26848,20 +26848,20 @@ var require_fetch = __commonJS({
|
|
|
26848
26848
|
return false;
|
|
26849
26849
|
}
|
|
26850
26850
|
const headersList = new HeadersList();
|
|
26851
|
-
for (const [name,
|
|
26852
|
-
if (
|
|
26851
|
+
for (const [name, value2] of Object.entries(headers)) {
|
|
26852
|
+
if (value2 == null) {
|
|
26853
26853
|
continue;
|
|
26854
26854
|
}
|
|
26855
26855
|
const headerName = name.toLowerCase();
|
|
26856
|
-
if (Array.isArray(
|
|
26857
|
-
for (const entry of
|
|
26856
|
+
if (Array.isArray(value2)) {
|
|
26857
|
+
for (const entry of value2) {
|
|
26858
26858
|
headersList.append(headerName, String(entry), true);
|
|
26859
26859
|
}
|
|
26860
26860
|
} else {
|
|
26861
|
-
headersList.append(headerName, String(
|
|
26861
|
+
headersList.append(headerName, String(value2), true);
|
|
26862
26862
|
}
|
|
26863
26863
|
}
|
|
26864
|
-
|
|
26864
|
+
resolve2({
|
|
26865
26865
|
status,
|
|
26866
26866
|
statusText: STATUS_CODES[status],
|
|
26867
26867
|
headersList,
|
|
@@ -26876,16 +26876,16 @@ var require_fetch = __commonJS({
|
|
|
26876
26876
|
const headersList = new HeadersList();
|
|
26877
26877
|
for (let i = 0; i < rawHeaders.length; i += 2) {
|
|
26878
26878
|
const nameStr = bufferToLowerCasedHeaderName(rawHeaders[i]);
|
|
26879
|
-
const
|
|
26880
|
-
if (Array.isArray(
|
|
26881
|
-
for (const val of
|
|
26879
|
+
const value2 = rawHeaders[i + 1];
|
|
26880
|
+
if (Array.isArray(value2) && !Buffer.isBuffer(rawHeaders[i + 1])) {
|
|
26881
|
+
for (const val of value2) {
|
|
26882
26882
|
headersList.append(nameStr, val.toString("latin1"), true);
|
|
26883
26883
|
}
|
|
26884
26884
|
} else {
|
|
26885
|
-
headersList.append(nameStr,
|
|
26885
|
+
headersList.append(nameStr, value2.toString("latin1"), true);
|
|
26886
26886
|
}
|
|
26887
26887
|
}
|
|
26888
|
-
|
|
26888
|
+
resolve2({
|
|
26889
26889
|
status,
|
|
26890
26890
|
statusText: STATUS_CODES[status],
|
|
26891
26891
|
headersList,
|
|
@@ -26921,10 +26921,10 @@ var require_util3 = __commonJS({
|
|
|
26921
26921
|
function getFieldValues(header) {
|
|
26922
26922
|
assert(header !== null);
|
|
26923
26923
|
const values = [];
|
|
26924
|
-
for (let
|
|
26925
|
-
|
|
26926
|
-
if (isValidHeaderName(
|
|
26927
|
-
values.push(
|
|
26924
|
+
for (let value2 of header.split(",")) {
|
|
26925
|
+
value2 = value2.trim();
|
|
26926
|
+
if (isValidHeaderName(value2)) {
|
|
26927
|
+
values.push(value2);
|
|
26928
26928
|
}
|
|
26929
26929
|
}
|
|
26930
26930
|
return values;
|
|
@@ -27612,9 +27612,9 @@ var require_constants5 = __commonJS({
|
|
|
27612
27612
|
var require_util4 = __commonJS({
|
|
27613
27613
|
"../../node_modules/.pnpm/undici@7.30.1/node_modules/undici/lib/web/cookies/util.js"(exports2, module2) {
|
|
27614
27614
|
"use strict";
|
|
27615
|
-
function isCTLExcludingHtab(
|
|
27616
|
-
for (let i = 0; i <
|
|
27617
|
-
const code =
|
|
27615
|
+
function isCTLExcludingHtab(value2) {
|
|
27616
|
+
for (let i = 0; i < value2.length; ++i) {
|
|
27617
|
+
const code = value2.charCodeAt(i);
|
|
27618
27618
|
if (code >= 0 && code <= 8 || code >= 10 && code <= 31 || code === 127) {
|
|
27619
27619
|
return true;
|
|
27620
27620
|
}
|
|
@@ -27647,18 +27647,18 @@ var require_util4 = __commonJS({
|
|
|
27647
27647
|
}
|
|
27648
27648
|
}
|
|
27649
27649
|
}
|
|
27650
|
-
function validateCookieValue(
|
|
27651
|
-
let len =
|
|
27650
|
+
function validateCookieValue(value2) {
|
|
27651
|
+
let len = value2.length;
|
|
27652
27652
|
let i = 0;
|
|
27653
|
-
if (
|
|
27654
|
-
if (len === 1 ||
|
|
27653
|
+
if (value2[0] === '"') {
|
|
27654
|
+
if (len === 1 || value2[len - 1] !== '"') {
|
|
27655
27655
|
throw new Error("Invalid cookie value");
|
|
27656
27656
|
}
|
|
27657
27657
|
--len;
|
|
27658
27658
|
++i;
|
|
27659
27659
|
}
|
|
27660
27660
|
while (i < len) {
|
|
27661
|
-
const code =
|
|
27661
|
+
const code = value2.charCodeAt(i++);
|
|
27662
27662
|
if (code < 33 || // exclude CTLs (0-31)
|
|
27663
27663
|
code > 126 || // non-ascii and DEL (127)
|
|
27664
27664
|
code === 34 || // "
|
|
@@ -27800,9 +27800,9 @@ var require_util4 = __commonJS({
|
|
|
27800
27800
|
if (!part.includes("=")) {
|
|
27801
27801
|
throw new Error("Invalid unparsed");
|
|
27802
27802
|
}
|
|
27803
|
-
const [key, ...
|
|
27803
|
+
const [key, ...value2] = part.split("=");
|
|
27804
27804
|
const trimmedKey = key.trim();
|
|
27805
|
-
const joinedValue =
|
|
27805
|
+
const joinedValue = value2.join("=");
|
|
27806
27806
|
validateCookieName(trimmedKey);
|
|
27807
27807
|
validateCookieValue(joinedValue);
|
|
27808
27808
|
out.push(`${trimmedKey}=${joinedValue}`);
|
|
@@ -27835,7 +27835,7 @@ var require_parse = __commonJS({
|
|
|
27835
27835
|
let nameValuePair = "";
|
|
27836
27836
|
let unparsedAttributes = "";
|
|
27837
27837
|
let name = "";
|
|
27838
|
-
let
|
|
27838
|
+
let value2 = "";
|
|
27839
27839
|
if (header.includes(";")) {
|
|
27840
27840
|
const position = { position: 0 };
|
|
27841
27841
|
nameValuePair = collectASequenceOfCodePointsFast(";", header, position);
|
|
@@ -27844,7 +27844,7 @@ var require_parse = __commonJS({
|
|
|
27844
27844
|
nameValuePair = header;
|
|
27845
27845
|
}
|
|
27846
27846
|
if (!nameValuePair.includes("=")) {
|
|
27847
|
-
|
|
27847
|
+
value2 = nameValuePair;
|
|
27848
27848
|
} else {
|
|
27849
27849
|
const position = { position: 0 };
|
|
27850
27850
|
name = collectASequenceOfCodePointsFast(
|
|
@@ -27852,16 +27852,16 @@ var require_parse = __commonJS({
|
|
|
27852
27852
|
nameValuePair,
|
|
27853
27853
|
position
|
|
27854
27854
|
);
|
|
27855
|
-
|
|
27855
|
+
value2 = nameValuePair.slice(position.position + 1);
|
|
27856
27856
|
}
|
|
27857
27857
|
name = name.trim();
|
|
27858
|
-
|
|
27859
|
-
if (name.length +
|
|
27858
|
+
value2 = value2.trim();
|
|
27859
|
+
if (name.length + value2.length > maxNameValuePairSize) {
|
|
27860
27860
|
return null;
|
|
27861
27861
|
}
|
|
27862
27862
|
return {
|
|
27863
27863
|
name,
|
|
27864
|
-
value,
|
|
27864
|
+
value: value2,
|
|
27865
27865
|
...parseUnparsedAttributes(unparsedAttributes)
|
|
27866
27866
|
};
|
|
27867
27867
|
}
|
|
@@ -27975,8 +27975,8 @@ var require_cookies = __commonJS({
|
|
|
27975
27975
|
return out;
|
|
27976
27976
|
}
|
|
27977
27977
|
for (const piece of cookie.split(";")) {
|
|
27978
|
-
const [name, ...
|
|
27979
|
-
out[name.trim()] =
|
|
27978
|
+
const [name, ...value2] = piece.split("=");
|
|
27979
|
+
out[name.trim()] = value2.join("=");
|
|
27980
27980
|
}
|
|
27981
27981
|
return out;
|
|
27982
27982
|
}
|
|
@@ -28037,11 +28037,11 @@ var require_cookies = __commonJS({
|
|
|
28037
28037
|
key: "value"
|
|
28038
28038
|
},
|
|
28039
28039
|
{
|
|
28040
|
-
converter: webidl.nullableConverter((
|
|
28041
|
-
if (typeof
|
|
28042
|
-
return webidl.converters["unsigned long long"](
|
|
28040
|
+
converter: webidl.nullableConverter((value2) => {
|
|
28041
|
+
if (typeof value2 === "number") {
|
|
28042
|
+
return webidl.converters["unsigned long long"](value2);
|
|
28043
28043
|
}
|
|
28044
|
-
return new Date(
|
|
28044
|
+
return new Date(value2);
|
|
28045
28045
|
}),
|
|
28046
28046
|
key: "expires",
|
|
28047
28047
|
defaultValue: () => null
|
|
@@ -28503,26 +28503,26 @@ var require_util5 = __commonJS({
|
|
|
28503
28503
|
const extensionList = /* @__PURE__ */ new Map();
|
|
28504
28504
|
while (position.position < extensions.length) {
|
|
28505
28505
|
const pair = collectASequenceOfCodePointsFast(";", extensions, position);
|
|
28506
|
-
const [name,
|
|
28506
|
+
const [name, value2 = ""] = pair.split("=", 2);
|
|
28507
28507
|
extensionList.set(
|
|
28508
28508
|
removeHTTPWhitespace(name, true, false),
|
|
28509
|
-
removeHTTPWhitespace(
|
|
28509
|
+
removeHTTPWhitespace(value2, false, true)
|
|
28510
28510
|
);
|
|
28511
28511
|
position.position++;
|
|
28512
28512
|
}
|
|
28513
28513
|
return extensionList;
|
|
28514
28514
|
}
|
|
28515
|
-
function isValidClientWindowBits(
|
|
28516
|
-
if (
|
|
28515
|
+
function isValidClientWindowBits(value2) {
|
|
28516
|
+
if (value2.length === 0) {
|
|
28517
28517
|
return false;
|
|
28518
28518
|
}
|
|
28519
|
-
for (let i = 0; i <
|
|
28520
|
-
const byte =
|
|
28519
|
+
for (let i = 0; i < value2.length; i++) {
|
|
28520
|
+
const byte = value2.charCodeAt(i);
|
|
28521
28521
|
if (byte < 48 || byte > 57) {
|
|
28522
28522
|
return false;
|
|
28523
28523
|
}
|
|
28524
28524
|
}
|
|
28525
|
-
const num = Number.parseInt(
|
|
28525
|
+
const num = Number.parseInt(value2, 10);
|
|
28526
28526
|
return num >= 8 && num <= 15;
|
|
28527
28527
|
}
|
|
28528
28528
|
function getURLRecord(url, baseURL) {
|
|
@@ -30282,13 +30282,13 @@ var require_websocketstream = __commonJS({
|
|
|
30282
30282
|
var require_util6 = __commonJS({
|
|
30283
30283
|
"../../node_modules/.pnpm/undici@7.30.1/node_modules/undici/lib/web/eventsource/util.js"(exports2, module2) {
|
|
30284
30284
|
"use strict";
|
|
30285
|
-
function isValidLastEventId(
|
|
30286
|
-
return
|
|
30285
|
+
function isValidLastEventId(value2) {
|
|
30286
|
+
return value2.indexOf("\0") === -1;
|
|
30287
30287
|
}
|
|
30288
|
-
function isASCIINumber(
|
|
30289
|
-
if (
|
|
30290
|
-
for (let i = 0; i <
|
|
30291
|
-
if (
|
|
30288
|
+
function isASCIINumber(value2) {
|
|
30289
|
+
if (value2.length === 0) return false;
|
|
30290
|
+
for (let i = 0; i < value2.length; i++) {
|
|
30291
|
+
if (value2.charCodeAt(i) < 48 || value2.charCodeAt(i) > 57) return false;
|
|
30292
30292
|
}
|
|
30293
30293
|
return true;
|
|
30294
30294
|
}
|
|
@@ -30514,12 +30514,12 @@ var require_eventsource_stream = __commonJS({
|
|
|
30514
30514
|
const valueBytes = line.length - valueStart;
|
|
30515
30515
|
const dataSize = this.eventFieldSizes.data + (event.data === void 0 ? 0 : 1) + valueBytes;
|
|
30516
30516
|
this.setEventFieldSize("data", dataSize);
|
|
30517
|
-
const
|
|
30517
|
+
const value2 = line.toString("utf8", valueStart);
|
|
30518
30518
|
if (event.data === void 0) {
|
|
30519
|
-
event.data =
|
|
30519
|
+
event.data = value2;
|
|
30520
30520
|
} else {
|
|
30521
30521
|
event.data += `
|
|
30522
|
-
${
|
|
30522
|
+
${value2}`;
|
|
30523
30523
|
}
|
|
30524
30524
|
this.dataLineCount++;
|
|
30525
30525
|
return;
|
|
@@ -31221,7 +31221,8 @@ ${captureLines}` : capture.stack;
|
|
|
31221
31221
|
});
|
|
31222
31222
|
|
|
31223
31223
|
// src/main.ts
|
|
31224
|
-
var
|
|
31224
|
+
var import_node_crypto2 = require("node:crypto");
|
|
31225
|
+
var import_node_fs4 = require("node:fs");
|
|
31225
31226
|
|
|
31226
31227
|
// src/client.ts
|
|
31227
31228
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
@@ -31263,7 +31264,7 @@ async function verifyDevFileLink(secret, pathAndQuery, action, now = Date.now())
|
|
|
31263
31264
|
return diff === 0 ? g : null;
|
|
31264
31265
|
}
|
|
31265
31266
|
function validDevFilePath(path) {
|
|
31266
|
-
return !!path && !path.startsWith("/") &&
|
|
31267
|
+
return !!path && !path.startsWith("/") && !/[\\\u0000-\u001f\u007f]/.test(path) && path.split("/").every((p) => p !== "" && p !== "." && p !== "..");
|
|
31267
31268
|
}
|
|
31268
31269
|
|
|
31269
31270
|
// ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/wrapper.mjs
|
|
@@ -31469,7 +31470,7 @@ function refusal(status, body) {
|
|
|
31469
31470
|
function connectWs(e) {
|
|
31470
31471
|
const url = e.url.replace(/^http/, "ws");
|
|
31471
31472
|
const agent = wsAgent(url);
|
|
31472
|
-
return new Promise((
|
|
31473
|
+
return new Promise((resolve2, reject) => {
|
|
31473
31474
|
const ws = new wrapper_default(url, {
|
|
31474
31475
|
headers: { authorization: `Bearer ${e.token}` },
|
|
31475
31476
|
perMessageDeflate: false,
|
|
@@ -31532,7 +31533,7 @@ function connectWs(e) {
|
|
|
31532
31533
|
link.onClose(reason.toString() || `closed (${code})`);
|
|
31533
31534
|
});
|
|
31534
31535
|
ws.on("error", () => ws.terminate());
|
|
31535
|
-
|
|
31536
|
+
resolve2(link);
|
|
31536
31537
|
});
|
|
31537
31538
|
});
|
|
31538
31539
|
}
|
|
@@ -31714,7 +31715,7 @@ var TunnelClient = class {
|
|
|
31714
31715
|
serve(link, onReady) {
|
|
31715
31716
|
this.link = link;
|
|
31716
31717
|
const session = new LinkSession(link, this.o.port, this.o.localHost ?? "127.0.0.1", this.o.filesPort);
|
|
31717
|
-
return new Promise((
|
|
31718
|
+
return new Promise((resolve2) => {
|
|
31718
31719
|
let final = false;
|
|
31719
31720
|
session.onReady = (r) => {
|
|
31720
31721
|
onReady();
|
|
@@ -31732,7 +31733,7 @@ var TunnelClient = class {
|
|
|
31732
31733
|
clearInterval(watch);
|
|
31733
31734
|
session.closeAll();
|
|
31734
31735
|
this.link = null;
|
|
31735
|
-
|
|
31736
|
+
resolve2({ reason: session.byeReason ?? reason, final });
|
|
31736
31737
|
};
|
|
31737
31738
|
if (link.closed) link.onClose("closed");
|
|
31738
31739
|
else session.start();
|
|
@@ -31879,10 +31880,10 @@ var LinkSession = class {
|
|
|
31879
31880
|
for (const [k, v] of headerList(list)) {
|
|
31880
31881
|
const n = k.toLowerCase();
|
|
31881
31882
|
if (n === "host" || FORWARDED.has(n)) continue;
|
|
31882
|
-
let
|
|
31883
|
-
if (n === "origin" && this.previewOrigin && v.toLowerCase() === this.previewOrigin)
|
|
31883
|
+
let value2 = v;
|
|
31884
|
+
if (n === "origin" && this.previewOrigin && v.toLowerCase() === this.previewOrigin) value2 = `http://localhost:${this.port}`;
|
|
31884
31885
|
const have = out[n];
|
|
31885
|
-
out[n] = have === void 0 ?
|
|
31886
|
+
out[n] = have === void 0 ? value2 : Array.isArray(have) ? [...have, value2] : n === "cookie" ? `${have}; ${value2}` : [have, value2];
|
|
31886
31887
|
}
|
|
31887
31888
|
out.host = `localhost:${this.port}`;
|
|
31888
31889
|
out["x-forwarded-host"] = `localhost:${this.port}`;
|
|
@@ -31998,9 +31999,6 @@ function sendableCode(code) {
|
|
|
31998
31999
|
return 1e3;
|
|
31999
32000
|
}
|
|
32000
32001
|
|
|
32001
|
-
// src/main.ts
|
|
32002
|
-
var import_node_crypto = require("node:crypto");
|
|
32003
|
-
|
|
32004
32002
|
// src/dev.ts
|
|
32005
32003
|
var import_node_child_process = require("node:child_process");
|
|
32006
32004
|
var import_node_fs = require("node:fs");
|
|
@@ -32032,17 +32030,17 @@ var DevServer = class {
|
|
|
32032
32030
|
const [cmd, args] = devCommand(this.o.port);
|
|
32033
32031
|
while (!this.stopped) {
|
|
32034
32032
|
const started = this.clock();
|
|
32035
|
-
const how = await new Promise((
|
|
32033
|
+
const how = await new Promise((resolve2) => {
|
|
32036
32034
|
let child;
|
|
32037
32035
|
try {
|
|
32038
32036
|
child = this.spawn(cmd, args);
|
|
32039
32037
|
} catch (e) {
|
|
32040
|
-
|
|
32038
|
+
resolve2(e instanceof Error ? e.message : String(e));
|
|
32041
32039
|
return;
|
|
32042
32040
|
}
|
|
32043
32041
|
this.child = child;
|
|
32044
|
-
child.once("error", (e) =>
|
|
32045
|
-
child.once("exit", (code, signal) =>
|
|
32042
|
+
child.once("error", (e) => resolve2(e.message));
|
|
32043
|
+
child.once("exit", (code, signal) => resolve2(signal ? `signal ${signal}` : `code ${code}`));
|
|
32046
32044
|
});
|
|
32047
32045
|
this.child = null;
|
|
32048
32046
|
if (this.stopped) break;
|
|
@@ -32074,6 +32072,7 @@ function devDataDir(appDir) {
|
|
|
32074
32072
|
}
|
|
32075
32073
|
|
|
32076
32074
|
// src/dev-files.ts
|
|
32075
|
+
var import_node_crypto = require("node:crypto");
|
|
32077
32076
|
var import_node_fs2 = require("node:fs");
|
|
32078
32077
|
var import_promises = require("node:fs/promises");
|
|
32079
32078
|
var import_node_http2 = __toESM(require("node:http"), 1);
|
|
@@ -32107,15 +32106,16 @@ async function startDevFiles(o) {
|
|
|
32107
32106
|
if (Number(req.headers["content-length"] ?? 0) > MAX_UPLOAD) return fail(res, 413, "The file is too large.");
|
|
32108
32107
|
await (0, import_promises.mkdir)((0, import_node_path2.dirname)(file), { recursive: true });
|
|
32109
32108
|
await (0, import_promises.mkdir)((0, import_node_path2.dirname)(meta), { recursive: true });
|
|
32110
|
-
|
|
32109
|
+
await (0, import_promises.mkdir)((0, import_node_path2.join)(o.dataDir, "uploads"), { recursive: true });
|
|
32110
|
+
const tmp = (0, import_node_path2.join)(o.dataDir, "uploads", (0, import_node_crypto.randomBytes)(12).toString("hex"));
|
|
32111
32111
|
let size2 = 0;
|
|
32112
32112
|
req.on("data", (c) => {
|
|
32113
32113
|
size2 += c.length;
|
|
32114
32114
|
if (size2 > MAX_UPLOAD) req.destroy(new Error("too large"));
|
|
32115
32115
|
});
|
|
32116
32116
|
await (0, import_promises2.pipeline)(req, (0, import_node_fs2.createWriteStream)(tmp));
|
|
32117
|
-
await (0, import_promises.rename)(tmp, file);
|
|
32118
32117
|
await (0, import_promises.writeFile)(meta, JSON.stringify({ contentType: type2 }));
|
|
32118
|
+
await (0, import_promises.rename)(tmp, file);
|
|
32119
32119
|
res.writeHead(200, { "cache-control": "no-store" });
|
|
32120
32120
|
return res.end();
|
|
32121
32121
|
}
|
|
@@ -32141,14 +32141,170 @@ async function startDevFiles(o) {
|
|
|
32141
32141
|
if (method === "HEAD") return res.end();
|
|
32142
32142
|
await (0, import_promises2.pipeline)((0, import_node_fs2.createReadStream)(file), res);
|
|
32143
32143
|
}
|
|
32144
|
-
await new Promise((
|
|
32144
|
+
await new Promise((resolve2) => server.listen(0, "127.0.0.1", resolve2));
|
|
32145
32145
|
const addr = server.address();
|
|
32146
32146
|
if (!addr || typeof addr === "string") throw new Error("The file server did not start.");
|
|
32147
32147
|
return { port: addr.port, close: () => server.close() };
|
|
32148
32148
|
}
|
|
32149
32149
|
|
|
32150
|
+
// src/preview.ts
|
|
32151
|
+
var import_node_child_process2 = require("node:child_process");
|
|
32152
|
+
var import_node_fs3 = require("node:fs");
|
|
32153
|
+
var import_node_os = require("node:os");
|
|
32154
|
+
var import_node_path3 = require("node:path");
|
|
32155
|
+
var TOKEN_MAX_AGE_MS = 12 * 60 * 60 * 1e3;
|
|
32156
|
+
var buildersDir = () => (0, import_node_path3.join)((0, import_node_os.homedir)(), ".builders");
|
|
32157
|
+
function value(rest, i, name) {
|
|
32158
|
+
const v = rest[i + 1];
|
|
32159
|
+
if (v === void 0) throw new Error(`--${name} needs a value.`);
|
|
32160
|
+
return v;
|
|
32161
|
+
}
|
|
32162
|
+
function parsePreviewArgs(rest, cwd) {
|
|
32163
|
+
const o = {};
|
|
32164
|
+
let restart = false;
|
|
32165
|
+
for (let i = 0; i < rest.length; i++) {
|
|
32166
|
+
const a = rest[i];
|
|
32167
|
+
if (a === "--restart") {
|
|
32168
|
+
restart = true;
|
|
32169
|
+
continue;
|
|
32170
|
+
}
|
|
32171
|
+
const m = /^--(port|url|preview-url|token-file|dev-url|add-ons)$/.exec(a);
|
|
32172
|
+
if (!m) throw new Error(`Unknown option ${a}.`);
|
|
32173
|
+
o[m[1]] = value(rest, i++, m[1]);
|
|
32174
|
+
}
|
|
32175
|
+
for (const k of ["port", "url", "preview-url", "token-file"]) if (!o[k]) throw new Error(`Give --${k}.`);
|
|
32176
|
+
const record = {
|
|
32177
|
+
dir: (0, import_node_path3.resolve)(cwd),
|
|
32178
|
+
port: Number(o.port),
|
|
32179
|
+
tunnelUrl: o.url,
|
|
32180
|
+
previewUrl: o["preview-url"],
|
|
32181
|
+
tokenFile: (0, import_node_path3.resolve)(cwd, o["token-file"]),
|
|
32182
|
+
...o["dev-url"] ? { devUrl: o["dev-url"] } : {},
|
|
32183
|
+
...o["add-ons"] !== void 0 ? { addOns: o["add-ons"] } : {}
|
|
32184
|
+
};
|
|
32185
|
+
const problem = checkRecord(record, new URL(record.tunnelUrl).host);
|
|
32186
|
+
if (problem) throw new Error(problem);
|
|
32187
|
+
return { record, restart };
|
|
32188
|
+
}
|
|
32189
|
+
function checkRecord(r, host, now = Date.now()) {
|
|
32190
|
+
if (!Number.isInteger(r.port) || r.port < 1024 || r.port > 65535) return "The port is not valid.";
|
|
32191
|
+
if (typeof r.dir !== "string" || !(0, import_node_path3.isAbsolute)(r.dir) || !(0, import_node_fs3.existsSync)((0, import_node_path3.join)(r.dir, ".git"))) return "The app folder is not a git folder.";
|
|
32192
|
+
const url = (u) => {
|
|
32193
|
+
try {
|
|
32194
|
+
return typeof u === "string" ? new URL(u) : null;
|
|
32195
|
+
} catch {
|
|
32196
|
+
return null;
|
|
32197
|
+
}
|
|
32198
|
+
};
|
|
32199
|
+
const tunnel = url(r.tunnelUrl);
|
|
32200
|
+
const dev = r.devUrl === void 0 ? null : url(r.devUrl);
|
|
32201
|
+
const preview = url(r.previewUrl);
|
|
32202
|
+
if (!tunnel || tunnel.protocol !== "https:" || tunnel.host !== host || tunnel.pathname !== "/_tunnel") return "The tunnel URL is not of this Builders host.";
|
|
32203
|
+
if (r.devUrl !== void 0 && (!dev || dev.protocol !== "https:" || dev.host !== host)) return "The dev URL is not of this Builders host.";
|
|
32204
|
+
if (!preview || preview.protocol !== "https:" || !preview.host.startsWith("d--") || !preview.host.endsWith(`.${host}`)) return "The preview URL is not of this Builders host.";
|
|
32205
|
+
if (typeof r.tokenFile !== "string" || (0, import_node_path3.dirname)(r.tokenFile) !== buildersDir() || !r.tokenFile.endsWith(".tunnel")) return "The token file is not in ~/.builders.";
|
|
32206
|
+
let age;
|
|
32207
|
+
try {
|
|
32208
|
+
age = now - (0, import_node_fs3.statSync)(r.tokenFile).mtimeMs;
|
|
32209
|
+
} catch {
|
|
32210
|
+
return "The token file is missing.";
|
|
32211
|
+
}
|
|
32212
|
+
if (age > TOKEN_MAX_AGE_MS) return "The token is older than 12 hours.";
|
|
32213
|
+
if (r.addOns !== void 0 && !/^[a-z,-]*$/.test(r.addOns)) return "The add-ons are not valid.";
|
|
32214
|
+
return null;
|
|
32215
|
+
}
|
|
32216
|
+
var logFile = (r) => (0, import_node_path3.join)((0, import_node_os.tmpdir)(), `builders-${(0, import_node_path3.basename)(r.dir)}-preview.log`);
|
|
32217
|
+
var recordFile = (r) => r.tokenFile.replace(/\.tunnel$/, ".preview.json");
|
|
32218
|
+
var pidFile = (r) => r.tokenFile.replace(/\.tunnel$/, ".pid");
|
|
32219
|
+
function runningPid(r) {
|
|
32220
|
+
let pid;
|
|
32221
|
+
try {
|
|
32222
|
+
pid = Number((0, import_node_fs3.readFileSync)(pidFile(r), "utf8").trim());
|
|
32223
|
+
} catch {
|
|
32224
|
+
return null;
|
|
32225
|
+
}
|
|
32226
|
+
if (!Number.isInteger(pid) || pid <= 1) return null;
|
|
32227
|
+
try {
|
|
32228
|
+
process.kill(pid, 0);
|
|
32229
|
+
} catch {
|
|
32230
|
+
return null;
|
|
32231
|
+
}
|
|
32232
|
+
try {
|
|
32233
|
+
const cmd = (0, import_node_fs3.readFileSync)(`/proc/${pid}/cmdline`, "utf8");
|
|
32234
|
+
return cmd.includes("tunnel") && cmd.includes("--dev") ? pid : null;
|
|
32235
|
+
} catch {
|
|
32236
|
+
return (0, import_node_fs3.existsSync)("/proc") ? null : pid;
|
|
32237
|
+
}
|
|
32238
|
+
}
|
|
32239
|
+
async function startPreview(r, o = {}) {
|
|
32240
|
+
const pid = runningPid(r);
|
|
32241
|
+
if (pid && !o.restart) return "running";
|
|
32242
|
+
if (pid) {
|
|
32243
|
+
const group = (signal) => {
|
|
32244
|
+
try {
|
|
32245
|
+
process.kill(-pid, signal);
|
|
32246
|
+
} catch {
|
|
32247
|
+
}
|
|
32248
|
+
};
|
|
32249
|
+
group("SIGTERM");
|
|
32250
|
+
for (let i = 0; i < 50 && runningPid(r); i++) await new Promise((res) => setTimeout(res, 100));
|
|
32251
|
+
group("SIGKILL");
|
|
32252
|
+
}
|
|
32253
|
+
const log = (0, import_node_fs3.openSync)(logFile(r), "a");
|
|
32254
|
+
const child = (0, import_node_child_process2.spawn)(process.execPath, [o.script ?? process.argv[1], "tunnel", "--dev", "--port", String(r.port)], {
|
|
32255
|
+
cwd: r.dir,
|
|
32256
|
+
detached: true,
|
|
32257
|
+
stdio: ["ignore", log, log],
|
|
32258
|
+
env: {
|
|
32259
|
+
...process.env,
|
|
32260
|
+
BUILDERS_TUNNEL_URL: r.tunnelUrl,
|
|
32261
|
+
BUILDERS_TUNNEL_TOKEN_FILE: r.tokenFile,
|
|
32262
|
+
BUILDERS_DEV_PREVIEW_URL: r.previewUrl,
|
|
32263
|
+
...r.devUrl ? { BUILDERS_DEV_URL: r.devUrl } : {},
|
|
32264
|
+
...r.addOns !== void 0 ? { BUILDERS_DEV_ADDONS: r.addOns } : {}
|
|
32265
|
+
}
|
|
32266
|
+
});
|
|
32267
|
+
child.unref();
|
|
32268
|
+
(0, import_node_fs3.writeFileSync)(pidFile(r), `${child.pid}
|
|
32269
|
+
`, { mode: 384 });
|
|
32270
|
+
return "started";
|
|
32271
|
+
}
|
|
32272
|
+
async function previewCommand(rest, cwd = process.cwd()) {
|
|
32273
|
+
const { record, restart } = parsePreviewArgs(rest, cwd);
|
|
32274
|
+
(0, import_node_fs3.mkdirSync)(buildersDir(), { recursive: true, mode: 448 });
|
|
32275
|
+
(0, import_node_fs3.writeFileSync)(recordFile(record), `${JSON.stringify(record)}
|
|
32276
|
+
`, { mode: 384 });
|
|
32277
|
+
const did = await startPreview(record, { restart });
|
|
32278
|
+
console.error(did === "running" ? "The dev preview runs." : `The dev preview starts. Log: ${logFile(record)}`);
|
|
32279
|
+
return 0;
|
|
32280
|
+
}
|
|
32281
|
+
async function resumeCommand(rest) {
|
|
32282
|
+
const i = rest.indexOf("--host");
|
|
32283
|
+
const host = i >= 0 ? rest[i + 1] : void 0;
|
|
32284
|
+
if (!host || !/^[a-z0-9.-]+$/.test(host)) throw new Error("Give --host <tenant host>.");
|
|
32285
|
+
let names;
|
|
32286
|
+
try {
|
|
32287
|
+
names = (0, import_node_fs3.readdirSync)(buildersDir()).filter((n) => n.endsWith(".preview.json"));
|
|
32288
|
+
} catch {
|
|
32289
|
+
return 0;
|
|
32290
|
+
}
|
|
32291
|
+
for (const n of names) {
|
|
32292
|
+
let r;
|
|
32293
|
+
try {
|
|
32294
|
+
r = JSON.parse((0, import_node_fs3.readFileSync)((0, import_node_path3.join)(buildersDir(), n), "utf8"));
|
|
32295
|
+
} catch {
|
|
32296
|
+
continue;
|
|
32297
|
+
}
|
|
32298
|
+
if (checkRecord(r, host) || recordFile(r) !== (0, import_node_path3.join)(buildersDir(), n)) continue;
|
|
32299
|
+
await startPreview(r);
|
|
32300
|
+
}
|
|
32301
|
+
return 0;
|
|
32302
|
+
}
|
|
32303
|
+
|
|
32150
32304
|
// src/main.ts
|
|
32151
32305
|
var USAGE = `Usage: builders-cli tunnel --port <port> [--dev] [--url <tunnel url>] [--token-file <file>] [--transport auto|ws|poll]
|
|
32306
|
+
builders-cli preview --port <port> --url <tunnel url> --preview-url <url> --token-file <file> [--dev-url <url>] [--add-ons <list>] [--restart]
|
|
32307
|
+
builders-cli resume --host <tenant host>
|
|
32152
32308
|
|
|
32153
32309
|
--dev also run the app's dev server (pnpm dev --port <port>) in this folder, and start it again when it stops
|
|
32154
32310
|
|
|
@@ -32156,7 +32312,7 @@ Environment:
|
|
|
32156
32312
|
BUILDERS_TUNNEL_TOKEN_FILE a file with the tunnel token (or --token-file)
|
|
32157
32313
|
BUILDERS_TUNNEL_TOKEN the tunnel token, if there is no token file
|
|
32158
32314
|
BUILDERS_TUNNEL_URL the tunnel URL, if --url is not given`;
|
|
32159
|
-
function readTokenFile(file, read = (f) => (0,
|
|
32315
|
+
function readTokenFile(file, read = (f) => (0, import_node_fs4.readFileSync)(f, "utf8")) {
|
|
32160
32316
|
let text;
|
|
32161
32317
|
try {
|
|
32162
32318
|
text = read(file);
|
|
@@ -32217,6 +32373,14 @@ ${USAGE}`);
|
|
|
32217
32373
|
return { port, token, url: url.toString().replace(/\/$/, ""), transport, ...tokenFile ? { tokenFile } : {}, ...dev ? { dev } : {} };
|
|
32218
32374
|
}
|
|
32219
32375
|
async function main(argv = process.argv.slice(2), env = process.env) {
|
|
32376
|
+
if (argv[0] === "preview" || argv[0] === "resume") {
|
|
32377
|
+
try {
|
|
32378
|
+
return await (argv[0] === "preview" ? previewCommand(argv.slice(1)) : resumeCommand(argv.slice(1)));
|
|
32379
|
+
} catch (e) {
|
|
32380
|
+
console.error(e instanceof Error ? e.message : String(e));
|
|
32381
|
+
return 2;
|
|
32382
|
+
}
|
|
32383
|
+
}
|
|
32220
32384
|
let o;
|
|
32221
32385
|
try {
|
|
32222
32386
|
o = parseArgs(argv, env);
|
|
@@ -32236,7 +32400,7 @@ async function main(argv = process.argv.slice(2), env = process.env) {
|
|
|
32236
32400
|
let devEnv = {};
|
|
32237
32401
|
if (o.dev) {
|
|
32238
32402
|
const dataDir = devDataDir(process.cwd());
|
|
32239
|
-
const secret = (0,
|
|
32403
|
+
const secret = (0, import_node_crypto2.randomBytes)(32).toString("hex");
|
|
32240
32404
|
files = await startDevFiles({ dataDir, secret });
|
|
32241
32405
|
devEnv = { [DEV_DATA_DIR_ENV]: dataDir, [DEV_FILES_SECRET_ENV]: secret };
|
|
32242
32406
|
}
|