@thisismanta/semantic-version 11.6.0 → 11.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/make-next-release.js +200 -71
- package/lib/src.js +17 -16
- package/package.json +1 -1
package/lib/make-next-release.js
CHANGED
|
@@ -1783,13 +1783,21 @@ var require_dispatcher_base = /* @__PURE__ */ require_src.__commonJSMin(((export
|
|
|
1783
1783
|
const kOnDestroyed = Symbol("onDestroyed");
|
|
1784
1784
|
const kOnClosed = Symbol("onClosed");
|
|
1785
1785
|
const kInterceptedDispatch = Symbol("Intercepted Dispatch");
|
|
1786
|
+
const kWebSocketOptions = Symbol("webSocketOptions");
|
|
1786
1787
|
var DispatcherBase = class extends Dispatcher {
|
|
1787
|
-
constructor() {
|
|
1788
|
+
constructor(opts) {
|
|
1788
1789
|
super();
|
|
1789
1790
|
this[kDestroyed] = false;
|
|
1790
1791
|
this[kOnDestroyed] = null;
|
|
1791
1792
|
this[kClosed] = false;
|
|
1792
1793
|
this[kOnClosed] = [];
|
|
1794
|
+
this[kWebSocketOptions] = opts?.webSocket ?? {};
|
|
1795
|
+
}
|
|
1796
|
+
get webSocketOptions() {
|
|
1797
|
+
return {
|
|
1798
|
+
maxFragments: this[kWebSocketOptions].maxFragments ?? 131072,
|
|
1799
|
+
maxPayloadSize: this[kWebSocketOptions].maxPayloadSize ?? 128 * 1024 * 1024
|
|
1800
|
+
};
|
|
1793
1801
|
}
|
|
1794
1802
|
get destroyed() {
|
|
1795
1803
|
return this[kDestroyed];
|
|
@@ -1925,7 +1933,7 @@ var require_timers = /* @__PURE__ */ require_src.__commonJSMin(((exports, module
|
|
|
1925
1933
|
* @type {number}
|
|
1926
1934
|
* @default 499
|
|
1927
1935
|
*/
|
|
1928
|
-
const TICK_MS =
|
|
1936
|
+
const TICK_MS = 499;
|
|
1929
1937
|
/**
|
|
1930
1938
|
* fastNowTimeout is a Node.js timer used to manage and process
|
|
1931
1939
|
* the FastTimers stored in the `fastTimers` array.
|
|
@@ -5148,6 +5156,9 @@ var require_client_h1 = /* @__PURE__ */ require_src.__commonJSMin(((exports, mod
|
|
|
5148
5156
|
const FastBuffer = Buffer[Symbol.species];
|
|
5149
5157
|
const addListener = util.addListener;
|
|
5150
5158
|
const removeAllListeners = util.removeAllListeners;
|
|
5159
|
+
const kIdleSocketValidation = Symbol("kIdleSocketValidation");
|
|
5160
|
+
const kIdleSocketValidationTimeout = Symbol("kIdleSocketValidationTimeout");
|
|
5161
|
+
const kSocketUsed = Symbol("kSocketUsed");
|
|
5151
5162
|
let extractBody;
|
|
5152
5163
|
async function lazyllhttp() {
|
|
5153
5164
|
const llhttpWasmData = process.env.JEST_WORKER_ID ? require_llhttp_wasm() : void 0;
|
|
@@ -5204,11 +5215,10 @@ var require_client_h1 = /* @__PURE__ */ require_src.__commonJSMin(((exports, mod
|
|
|
5204
5215
|
let currentBufferRef = null;
|
|
5205
5216
|
let currentBufferSize = 0;
|
|
5206
5217
|
let currentBufferPtr = null;
|
|
5207
|
-
const USE_NATIVE_TIMER = 0;
|
|
5208
5218
|
const USE_FAST_TIMER = 1;
|
|
5209
|
-
const TIMEOUT_HEADERS =
|
|
5210
|
-
const TIMEOUT_BODY =
|
|
5211
|
-
const TIMEOUT_KEEP_ALIVE = 8
|
|
5219
|
+
const TIMEOUT_HEADERS = 3;
|
|
5220
|
+
const TIMEOUT_BODY = 5;
|
|
5221
|
+
const TIMEOUT_KEEP_ALIVE = 8;
|
|
5212
5222
|
var Parser = class {
|
|
5213
5223
|
constructor(client, socket, { exports: exports$1 }) {
|
|
5214
5224
|
assert$19(Number.isFinite(client[kMaxHeadersSize]) && client[kMaxHeadersSize] > 0);
|
|
@@ -5298,24 +5308,48 @@ var require_client_h1 = /* @__PURE__ */ require_src.__commonJSMin(((exports, mod
|
|
|
5298
5308
|
currentBufferRef = null;
|
|
5299
5309
|
}
|
|
5300
5310
|
const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr;
|
|
5301
|
-
if (ret
|
|
5302
|
-
|
|
5303
|
-
this.
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
/* istanbul ignore else: difficult to make a test case for */
|
|
5309
|
-
if (ptr) {
|
|
5310
|
-
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0);
|
|
5311
|
-
message = "Response does not match the HTTP/1.1 protocol (" + Buffer.from(llhttp.memory.buffer, ptr, len).toString() + ")";
|
|
5312
|
-
}
|
|
5313
|
-
throw new HTTPParserError(message, constants.ERROR[ret], data.slice(offset));
|
|
5311
|
+
if (ret !== constants.ERROR.OK) {
|
|
5312
|
+
const body = data.subarray(offset);
|
|
5313
|
+
if (ret === constants.ERROR.PAUSED_UPGRADE) this.onUpgrade(body);
|
|
5314
|
+
else if (ret === constants.ERROR.PAUSED) {
|
|
5315
|
+
this.paused = true;
|
|
5316
|
+
socket.unshift(body);
|
|
5317
|
+
} else throw this.createError(ret, body);
|
|
5314
5318
|
}
|
|
5315
5319
|
} catch (err) {
|
|
5316
5320
|
util.destroy(socket, err);
|
|
5317
5321
|
}
|
|
5318
5322
|
}
|
|
5323
|
+
finish() {
|
|
5324
|
+
assert$19(currentParser === null);
|
|
5325
|
+
assert$19(this.ptr != null);
|
|
5326
|
+
assert$19(!this.paused);
|
|
5327
|
+
const { llhttp } = this;
|
|
5328
|
+
let ret;
|
|
5329
|
+
try {
|
|
5330
|
+
currentParser = this;
|
|
5331
|
+
ret = llhttp.llhttp_finish(this.ptr);
|
|
5332
|
+
} finally {
|
|
5333
|
+
currentParser = null;
|
|
5334
|
+
}
|
|
5335
|
+
if (ret === constants.ERROR.OK) return null;
|
|
5336
|
+
if (ret === constants.ERROR.PAUSED || ret === constants.ERROR.PAUSED_UPGRADE) {
|
|
5337
|
+
this.paused = true;
|
|
5338
|
+
return null;
|
|
5339
|
+
}
|
|
5340
|
+
return this.createError(ret, EMPTY_BUF);
|
|
5341
|
+
}
|
|
5342
|
+
createError(ret, data) {
|
|
5343
|
+
const { llhttp, contentLength, bytesRead } = this;
|
|
5344
|
+
if (contentLength && bytesRead !== parseInt(contentLength, 10)) return new ResponseContentLengthMismatchError();
|
|
5345
|
+
const ptr = llhttp.llhttp_get_error_reason(this.ptr);
|
|
5346
|
+
let message = "";
|
|
5347
|
+
if (ptr) {
|
|
5348
|
+
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0);
|
|
5349
|
+
message = "Response does not match the HTTP/1.1 protocol (" + Buffer.from(llhttp.memory.buffer, ptr, len).toString() + ")";
|
|
5350
|
+
}
|
|
5351
|
+
return new HTTPParserError(message, constants.ERROR[ret], data);
|
|
5352
|
+
}
|
|
5319
5353
|
destroy() {
|
|
5320
5354
|
assert$19(this.ptr != null);
|
|
5321
5355
|
assert$19(currentParser == null);
|
|
@@ -5334,6 +5368,10 @@ var require_client_h1 = /* @__PURE__ */ require_src.__commonJSMin(((exports, mod
|
|
|
5334
5368
|
const { socket, client } = this;
|
|
5335
5369
|
/* istanbul ignore next: difficult to make a test case for */
|
|
5336
5370
|
if (socket.destroyed) return -1;
|
|
5371
|
+
if (client[kRunning] === 0) {
|
|
5372
|
+
util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket)));
|
|
5373
|
+
return -1;
|
|
5374
|
+
}
|
|
5337
5375
|
const request = client[kQueue][client[kRunningIdx]];
|
|
5338
5376
|
if (!request) return -1;
|
|
5339
5377
|
request.onResponseStarted();
|
|
@@ -5398,6 +5436,10 @@ var require_client_h1 = /* @__PURE__ */ require_src.__commonJSMin(((exports, mod
|
|
|
5398
5436
|
const { client, socket, headers, statusText } = this;
|
|
5399
5437
|
/* istanbul ignore next: difficult to make a test case for */
|
|
5400
5438
|
if (socket.destroyed) return -1;
|
|
5439
|
+
if (client[kRunning] === 0) {
|
|
5440
|
+
util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket)));
|
|
5441
|
+
return -1;
|
|
5442
|
+
}
|
|
5401
5443
|
const request = client[kQueue][client[kRunningIdx]];
|
|
5402
5444
|
/* istanbul ignore next: difficult to make a test case for */
|
|
5403
5445
|
if (!request) return -1;
|
|
@@ -5494,6 +5536,7 @@ var require_client_h1 = /* @__PURE__ */ require_src.__commonJSMin(((exports, mod
|
|
|
5494
5536
|
}
|
|
5495
5537
|
request.onComplete(headers);
|
|
5496
5538
|
client[kQueue][client[kRunningIdx]++] = null;
|
|
5539
|
+
socket[kSocketUsed] = true;
|
|
5497
5540
|
if (socket[kWriting]) {
|
|
5498
5541
|
assert$19(client[kRunning] === 0);
|
|
5499
5542
|
util.destroy(socket, new InformationalError("reset"));
|
|
@@ -5533,12 +5576,19 @@ var require_client_h1 = /* @__PURE__ */ require_src.__commonJSMin(((exports, mod
|
|
|
5533
5576
|
socket[kWriting] = false;
|
|
5534
5577
|
socket[kReset] = false;
|
|
5535
5578
|
socket[kBlocking] = false;
|
|
5579
|
+
socket[kIdleSocketValidation] = 0;
|
|
5580
|
+
socket[kIdleSocketValidationTimeout] = null;
|
|
5581
|
+
socket[kSocketUsed] = false;
|
|
5536
5582
|
socket[kParser] = new Parser(client, socket, llhttpInstance);
|
|
5537
5583
|
addListener(socket, "error", function(err) {
|
|
5538
5584
|
assert$19(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
|
|
5539
5585
|
const parser = this[kParser];
|
|
5540
5586
|
if (err.code === "ECONNRESET" && parser.statusCode && !parser.shouldKeepAlive) {
|
|
5541
|
-
parser.
|
|
5587
|
+
const parserErr = parser.finish();
|
|
5588
|
+
if (parserErr) {
|
|
5589
|
+
this[kError] = parserErr;
|
|
5590
|
+
this[kClient][kOnError](parserErr);
|
|
5591
|
+
}
|
|
5542
5592
|
return;
|
|
5543
5593
|
}
|
|
5544
5594
|
this[kError] = err;
|
|
@@ -5551,7 +5601,8 @@ var require_client_h1 = /* @__PURE__ */ require_src.__commonJSMin(((exports, mod
|
|
|
5551
5601
|
addListener(socket, "end", function() {
|
|
5552
5602
|
const parser = this[kParser];
|
|
5553
5603
|
if (parser.statusCode && !parser.shouldKeepAlive) {
|
|
5554
|
-
parser.
|
|
5604
|
+
const parserErr = parser.finish();
|
|
5605
|
+
if (parserErr) util.destroy(this, parserErr);
|
|
5555
5606
|
return;
|
|
5556
5607
|
}
|
|
5557
5608
|
util.destroy(this, new SocketError("other side closed", util.getSocketInfo(this)));
|
|
@@ -5559,8 +5610,9 @@ var require_client_h1 = /* @__PURE__ */ require_src.__commonJSMin(((exports, mod
|
|
|
5559
5610
|
addListener(socket, "close", function() {
|
|
5560
5611
|
const client = this[kClient];
|
|
5561
5612
|
const parser = this[kParser];
|
|
5613
|
+
clearIdleSocketValidation(this);
|
|
5562
5614
|
if (parser) {
|
|
5563
|
-
if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) parser.
|
|
5615
|
+
if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) this[kError] = parser.finish() || this[kError];
|
|
5564
5616
|
this[kParser].destroy();
|
|
5565
5617
|
this[kParser] = null;
|
|
5566
5618
|
}
|
|
@@ -5605,7 +5657,7 @@ var require_client_h1 = /* @__PURE__ */ require_src.__commonJSMin(((exports, mod
|
|
|
5605
5657
|
return socket.destroyed;
|
|
5606
5658
|
},
|
|
5607
5659
|
busy(request) {
|
|
5608
|
-
if (socket[kWriting] || socket[kReset] || socket[kBlocking]) return true;
|
|
5660
|
+
if (socket[kWriting] || socket[kReset] || socket[kBlocking] || socket[kIdleSocketValidation] === 1) return true;
|
|
5609
5661
|
if (request) {
|
|
5610
5662
|
if (client[kRunning] > 0 && !request.idempotent) return true;
|
|
5611
5663
|
if (client[kRunning] > 0 && (request.upgrade || request.method === "CONNECT")) return true;
|
|
@@ -5615,6 +5667,25 @@ var require_client_h1 = /* @__PURE__ */ require_src.__commonJSMin(((exports, mod
|
|
|
5615
5667
|
}
|
|
5616
5668
|
};
|
|
5617
5669
|
}
|
|
5670
|
+
function clearIdleSocketValidation(socket) {
|
|
5671
|
+
if (socket[kIdleSocketValidationTimeout]) {
|
|
5672
|
+
clearTimeout(socket[kIdleSocketValidationTimeout]);
|
|
5673
|
+
socket[kIdleSocketValidationTimeout] = null;
|
|
5674
|
+
}
|
|
5675
|
+
socket[kIdleSocketValidation] = 0;
|
|
5676
|
+
}
|
|
5677
|
+
function scheduleIdleSocketValidation(client, socket) {
|
|
5678
|
+
socket[kIdleSocketValidation] = 1;
|
|
5679
|
+
socket[kIdleSocketValidationTimeout] = setTimeout(() => {
|
|
5680
|
+
socket[kIdleSocketValidationTimeout] = null;
|
|
5681
|
+
socket[kIdleSocketValidation] = 2;
|
|
5682
|
+
if (client[kSocket] === socket && !socket.destroyed) client[kResume]();
|
|
5683
|
+
}, 0);
|
|
5684
|
+
socket[kIdleSocketValidationTimeout].unref?.();
|
|
5685
|
+
}
|
|
5686
|
+
/**
|
|
5687
|
+
* @param {import('./client.js')} client
|
|
5688
|
+
*/
|
|
5618
5689
|
function resumeH1(client) {
|
|
5619
5690
|
const socket = client[kSocket];
|
|
5620
5691
|
if (socket && !socket.destroyed) {
|
|
@@ -5627,6 +5698,23 @@ var require_client_h1 = /* @__PURE__ */ require_src.__commonJSMin(((exports, mod
|
|
|
5627
5698
|
socket.ref();
|
|
5628
5699
|
socket[kNoRef] = false;
|
|
5629
5700
|
}
|
|
5701
|
+
if (client[kRunning] === 0 && client[kPending] > 0 && socket[kSocketUsed]) {
|
|
5702
|
+
if (socket[kIdleSocketValidation] === 0) {
|
|
5703
|
+
scheduleIdleSocketValidation(client, socket);
|
|
5704
|
+
socket[kParser].readMore();
|
|
5705
|
+
if (socket.destroyed) return;
|
|
5706
|
+
return;
|
|
5707
|
+
}
|
|
5708
|
+
if (socket[kIdleSocketValidation] === 1) {
|
|
5709
|
+
socket[kParser].readMore();
|
|
5710
|
+
if (socket.destroyed) return;
|
|
5711
|
+
return;
|
|
5712
|
+
}
|
|
5713
|
+
}
|
|
5714
|
+
if (client[kRunning] === 0) {
|
|
5715
|
+
socket[kParser].readMore();
|
|
5716
|
+
if (socket.destroyed) return;
|
|
5717
|
+
}
|
|
5630
5718
|
if (client[kSize] === 0) {
|
|
5631
5719
|
if (socket[kParser].timeoutType !== TIMEOUT_KEEP_ALIVE) socket[kParser].setTimeout(client[kKeepAliveTimeoutValue], TIMEOUT_KEEP_ALIVE);
|
|
5632
5720
|
} else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) {
|
|
@@ -5665,6 +5753,7 @@ var require_client_h1 = /* @__PURE__ */ require_src.__commonJSMin(((exports, mod
|
|
|
5665
5753
|
process.emitWarning(new RequestContentLengthMismatchError());
|
|
5666
5754
|
}
|
|
5667
5755
|
const socket = client[kSocket];
|
|
5756
|
+
clearIdleSocketValidation(socket);
|
|
5668
5757
|
const abort = (err) => {
|
|
5669
5758
|
if (request.aborted || request.completed) return;
|
|
5670
5759
|
util.errorRequest(client, request, err || new RequestAbortedError());
|
|
@@ -6471,8 +6560,8 @@ var require_client = /* @__PURE__ */ require_src.__commonJSMin(((exports, module
|
|
|
6471
6560
|
* @param {string|URL} url
|
|
6472
6561
|
* @param {import('../../types/client.js').Client.Options} options
|
|
6473
6562
|
*/
|
|
6474
|
-
constructor(url, { interceptors, maxHeaderSize, headersTimeout, socketTimeout, requestTimeout, connectTimeout, bodyTimeout, idleTimeout, keepAlive, keepAliveTimeout, maxKeepAliveTimeout, keepAliveMaxTimeout, keepAliveTimeoutThreshold, socketPath, pipelining, tls, strictContentLength, maxCachedSessions, maxRedirections, connect, maxRequestsPerClient, localAddress, maxResponseSize, autoSelectFamily, autoSelectFamilyAttemptTimeout, maxConcurrentStreams, allowH2 } = {}) {
|
|
6475
|
-
super();
|
|
6563
|
+
constructor(url, { interceptors, maxHeaderSize, headersTimeout, socketTimeout, requestTimeout, connectTimeout, bodyTimeout, idleTimeout, keepAlive, keepAliveTimeout, maxKeepAliveTimeout, keepAliveMaxTimeout, keepAliveTimeoutThreshold, socketPath, pipelining, tls, strictContentLength, maxCachedSessions, maxRedirections, connect, maxRequestsPerClient, localAddress, maxResponseSize, autoSelectFamily, autoSelectFamilyAttemptTimeout, maxConcurrentStreams, allowH2, webSocket } = {}) {
|
|
6564
|
+
super({ webSocket });
|
|
6476
6565
|
if (keepAlive !== void 0) throw new InvalidArgumentError("unsupported keepAlive, use pipelining=0 instead");
|
|
6477
6566
|
if (socketTimeout !== void 0) throw new InvalidArgumentError("unsupported socketTimeout, use headersTimeout & bodyTimeout instead");
|
|
6478
6567
|
if (requestTimeout !== void 0) throw new InvalidArgumentError("unsupported requestTimeout, use headersTimeout & bodyTimeout instead");
|
|
@@ -6875,8 +6964,8 @@ var require_pool_base = /* @__PURE__ */ require_src.__commonJSMin(((exports, mod
|
|
|
6875
6964
|
const kRemoveClient = Symbol("remove client");
|
|
6876
6965
|
const kStats = Symbol("stats");
|
|
6877
6966
|
var PoolBase = class extends DispatcherBase {
|
|
6878
|
-
constructor() {
|
|
6879
|
-
super();
|
|
6967
|
+
constructor(opts) {
|
|
6968
|
+
super(opts);
|
|
6880
6969
|
this[kQueue] = new FixedQueue();
|
|
6881
6970
|
this[kClients] = [];
|
|
6882
6971
|
this[kQueued] = 0;
|
|
@@ -7006,7 +7095,6 @@ var require_pool = /* @__PURE__ */ require_src.__commonJSMin(((exports, module)
|
|
|
7006
7095
|
}
|
|
7007
7096
|
var Pool = class extends PoolBase {
|
|
7008
7097
|
constructor(origin, { connections, factory = defaultFactory, connect, connectTimeout, tls, maxCachedSessions, socketPath, autoSelectFamily, autoSelectFamilyAttemptTimeout, allowH2, ...options } = {}) {
|
|
7009
|
-
super();
|
|
7010
7098
|
if (connections != null && (!Number.isFinite(connections) || connections < 0)) throw new InvalidArgumentError("invalid connections");
|
|
7011
7099
|
if (typeof factory !== "function") throw new InvalidArgumentError("factory must be a function.");
|
|
7012
7100
|
if (connect != null && typeof connect !== "function" && typeof connect !== "object") throw new InvalidArgumentError("connect must be a function or an object");
|
|
@@ -7022,6 +7110,7 @@ var require_pool = /* @__PURE__ */ require_src.__commonJSMin(((exports, module)
|
|
|
7022
7110
|
} : void 0,
|
|
7023
7111
|
...connect
|
|
7024
7112
|
});
|
|
7113
|
+
super(options);
|
|
7025
7114
|
this[kInterceptors] = options.interceptors?.Pool && Array.isArray(options.interceptors.Pool) ? options.interceptors.Pool : [];
|
|
7026
7115
|
this[kConnections] = connections || null;
|
|
7027
7116
|
this[kUrl] = util.parseOrigin(origin);
|
|
@@ -7183,10 +7272,10 @@ var require_agent = /* @__PURE__ */ require_src.__commonJSMin(((exports, module)
|
|
|
7183
7272
|
}
|
|
7184
7273
|
var Agent = class extends DispatcherBase {
|
|
7185
7274
|
constructor({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
|
|
7186
|
-
super();
|
|
7187
7275
|
if (typeof factory !== "function") throw new InvalidArgumentError("factory must be a function.");
|
|
7188
7276
|
if (connect != null && typeof connect !== "function" && typeof connect !== "object") throw new InvalidArgumentError("connect must be a function or an object");
|
|
7189
7277
|
if (!Number.isInteger(maxRedirections) || maxRedirections < 0) throw new InvalidArgumentError("maxRedirections must be a positive number");
|
|
7278
|
+
super(options);
|
|
7190
7279
|
if (connect && typeof connect !== "function") connect = { ...connect };
|
|
7191
7280
|
this[kInterceptors] = options.interceptors?.Agent && Array.isArray(options.interceptors.Agent) ? options.interceptors.Agent : [createRedirectInterceptor({ maxRedirections })];
|
|
7192
7281
|
this[kOptions] = {
|
|
@@ -7977,7 +8066,7 @@ var require_readable = /* @__PURE__ */ require_src.__commonJSMin(((exports, modu
|
|
|
7977
8066
|
* @returns {Uint8Array}
|
|
7978
8067
|
*/
|
|
7979
8068
|
function chunksConcat(chunks, length) {
|
|
7980
|
-
if (chunks.length === 0 || length === 0) return new Uint8Array(0);
|
|
8069
|
+
if (chunks.length === 0 || length === 0) return /* @__PURE__ */ new Uint8Array(0);
|
|
7981
8070
|
if (chunks.length === 1) return new Uint8Array(chunks[0]);
|
|
7982
8071
|
const buffer = new Uint8Array(Buffer.allocUnsafeSlow(length).buffer);
|
|
7983
8072
|
let offset = 0;
|
|
@@ -11413,7 +11502,6 @@ var require_fetch = /* @__PURE__ */ require_src.__commonJSMin(((exports, module)
|
|
|
11413
11502
|
let httpFetchParams = null;
|
|
11414
11503
|
let httpRequest = null;
|
|
11415
11504
|
let response = null;
|
|
11416
|
-
const httpCache = null;
|
|
11417
11505
|
if (request.window === "no-window" && request.redirect === "error") {
|
|
11418
11506
|
httpFetchParams = fetchParams;
|
|
11419
11507
|
httpRequest = request;
|
|
@@ -11444,7 +11532,7 @@ var require_fetch = /* @__PURE__ */ require_src.__commonJSMin(((exports, module)
|
|
|
11444
11532
|
else httpRequest.headersList.append("accept-encoding", "gzip, deflate", true);
|
|
11445
11533
|
httpRequest.headersList.delete("host", true);
|
|
11446
11534
|
if (includeCredentials) {}
|
|
11447
|
-
|
|
11535
|
+
httpRequest.cache = "no-store";
|
|
11448
11536
|
if (httpRequest.cache !== "no-store" && httpRequest.cache !== "reload") {}
|
|
11449
11537
|
if (response == null) {
|
|
11450
11538
|
if (httpRequest.cache === "only-if-cached") return makeNetworkError("only if cached");
|
|
@@ -13295,12 +13383,10 @@ var require_parse = /* @__PURE__ */ require_src.__commonJSMin(((exports, module)
|
|
|
13295
13383
|
} else if (attributeNameLowercase === "secure") cookieAttributeList.secure = true;
|
|
13296
13384
|
else if (attributeNameLowercase === "httponly") cookieAttributeList.httpOnly = true;
|
|
13297
13385
|
else if (attributeNameLowercase === "samesite") {
|
|
13298
|
-
let enforcement = "Default";
|
|
13299
13386
|
const attributeValueLowercase = attributeValue.toLowerCase();
|
|
13300
|
-
if (attributeValueLowercase
|
|
13301
|
-
if (attributeValueLowercase
|
|
13302
|
-
if (attributeValueLowercase
|
|
13303
|
-
cookieAttributeList.sameSite = enforcement;
|
|
13387
|
+
if (attributeValueLowercase === "none") cookieAttributeList.sameSite = "None";
|
|
13388
|
+
else if (attributeValueLowercase === "strict") cookieAttributeList.sameSite = "Strict";
|
|
13389
|
+
else if (attributeValueLowercase === "lax") cookieAttributeList.sameSite = "Lax";
|
|
13304
13390
|
} else {
|
|
13305
13391
|
cookieAttributeList.unparsed ??= [];
|
|
13306
13392
|
cookieAttributeList.unparsed.push(`${attributeName}=${attributeValue}`);
|
|
@@ -14218,27 +14304,26 @@ var require_permessage_deflate = /* @__PURE__ */ require_src.__commonJSMin(((exp
|
|
|
14218
14304
|
]);
|
|
14219
14305
|
const kBuffer = Symbol("kBuffer");
|
|
14220
14306
|
const kLength = Symbol("kLength");
|
|
14221
|
-
const kDefaultMaxDecompressedSize = 4 * 1024 * 1024;
|
|
14222
14307
|
var PerMessageDeflate = class {
|
|
14223
14308
|
/** @type {import('node:zlib').InflateRaw} */
|
|
14224
14309
|
#inflate;
|
|
14225
14310
|
#options = {};
|
|
14226
|
-
|
|
14227
|
-
#aborted = false;
|
|
14228
|
-
/** @type {Function|null} */
|
|
14229
|
-
#currentCallback = null;
|
|
14311
|
+
#maxPayloadSize = 0;
|
|
14230
14312
|
/**
|
|
14231
14313
|
* @param {Map<string, string>} extensions
|
|
14232
14314
|
*/
|
|
14233
|
-
constructor(extensions) {
|
|
14315
|
+
constructor(extensions, options) {
|
|
14234
14316
|
this.#options.serverNoContextTakeover = extensions.has("server_no_context_takeover");
|
|
14235
14317
|
this.#options.serverMaxWindowBits = extensions.get("server_max_window_bits");
|
|
14318
|
+
this.#maxPayloadSize = options.maxPayloadSize;
|
|
14236
14319
|
}
|
|
14320
|
+
/**
|
|
14321
|
+
* Decompress a compressed payload.
|
|
14322
|
+
* @param {Buffer} chunk Compressed data
|
|
14323
|
+
* @param {boolean} fin Final fragment flag
|
|
14324
|
+
* @param {Function} callback Callback function
|
|
14325
|
+
*/
|
|
14237
14326
|
decompress(chunk, fin, callback) {
|
|
14238
|
-
if (this.#aborted) {
|
|
14239
|
-
callback(new MessageSizeExceededError());
|
|
14240
|
-
return;
|
|
14241
|
-
}
|
|
14242
14327
|
if (!this.#inflate) {
|
|
14243
14328
|
let windowBits = Z_DEFAULT_WINDOWBITS;
|
|
14244
14329
|
if (this.#options.serverMaxWindowBits) {
|
|
@@ -14257,18 +14342,11 @@ var require_permessage_deflate = /* @__PURE__ */ require_src.__commonJSMin(((exp
|
|
|
14257
14342
|
this.#inflate[kBuffer] = [];
|
|
14258
14343
|
this.#inflate[kLength] = 0;
|
|
14259
14344
|
this.#inflate.on("data", (data) => {
|
|
14260
|
-
if (this.#aborted) return;
|
|
14261
14345
|
this.#inflate[kLength] += data.length;
|
|
14262
|
-
if (this.#inflate[kLength] >
|
|
14263
|
-
|
|
14346
|
+
if (this.#maxPayloadSize > 0 && this.#inflate[kLength] > this.#maxPayloadSize) {
|
|
14347
|
+
callback(new MessageSizeExceededError());
|
|
14264
14348
|
this.#inflate.removeAllListeners();
|
|
14265
|
-
this.#inflate.destroy();
|
|
14266
14349
|
this.#inflate = null;
|
|
14267
|
-
if (this.#currentCallback) {
|
|
14268
|
-
const cb = this.#currentCallback;
|
|
14269
|
-
this.#currentCallback = null;
|
|
14270
|
-
cb(new MessageSizeExceededError());
|
|
14271
|
-
}
|
|
14272
14350
|
return;
|
|
14273
14351
|
}
|
|
14274
14352
|
this.#inflate[kBuffer].push(data);
|
|
@@ -14278,15 +14356,13 @@ var require_permessage_deflate = /* @__PURE__ */ require_src.__commonJSMin(((exp
|
|
|
14278
14356
|
callback(err);
|
|
14279
14357
|
});
|
|
14280
14358
|
}
|
|
14281
|
-
this.#currentCallback = callback;
|
|
14282
14359
|
this.#inflate.write(chunk);
|
|
14283
14360
|
if (fin) this.#inflate.write(tail);
|
|
14284
14361
|
this.#inflate.flush(() => {
|
|
14285
|
-
if (
|
|
14362
|
+
if (!this.#inflate) return;
|
|
14286
14363
|
const full = Buffer.concat(this.#inflate[kBuffer], this.#inflate[kLength]);
|
|
14287
14364
|
this.#inflate[kBuffer].length = 0;
|
|
14288
14365
|
this.#inflate[kLength] = 0;
|
|
14289
|
-
this.#currentCallback = null;
|
|
14290
14366
|
callback(null, full);
|
|
14291
14367
|
});
|
|
14292
14368
|
}
|
|
@@ -14305,8 +14381,14 @@ var require_receiver = /* @__PURE__ */ require_src.__commonJSMin(((exports, modu
|
|
|
14305
14381
|
const { WebsocketFrameSend } = require_frame();
|
|
14306
14382
|
const { closeWebSocketConnection } = require_connection();
|
|
14307
14383
|
const { PerMessageDeflate } = require_permessage_deflate();
|
|
14384
|
+
const { MessageSizeExceededError } = require_errors();
|
|
14385
|
+
function failWebsocketConnectionWithCode(ws, code, reason) {
|
|
14386
|
+
closeWebSocketConnection(ws, code, reason, Buffer.byteLength(reason));
|
|
14387
|
+
failWebsocketConnection(ws, reason);
|
|
14388
|
+
}
|
|
14308
14389
|
var ByteParser = class extends Writable {
|
|
14309
14390
|
#buffers = [];
|
|
14391
|
+
#fragmentsBytes = 0;
|
|
14310
14392
|
#byteOffset = 0;
|
|
14311
14393
|
#loop = false;
|
|
14312
14394
|
#state = parserStates.INFO;
|
|
@@ -14314,15 +14396,22 @@ var require_receiver = /* @__PURE__ */ require_src.__commonJSMin(((exports, modu
|
|
|
14314
14396
|
#fragments = [];
|
|
14315
14397
|
/** @type {Map<string, PerMessageDeflate>} */
|
|
14316
14398
|
#extensions;
|
|
14399
|
+
/** @type {number} */
|
|
14400
|
+
#maxFragments;
|
|
14401
|
+
/** @type {number} */
|
|
14402
|
+
#maxPayloadSize;
|
|
14317
14403
|
/**
|
|
14318
14404
|
* @param {import('./websocket').WebSocket} ws
|
|
14319
14405
|
* @param {Map<string, string>|null} extensions
|
|
14406
|
+
* @param {{ maxFragments?: number, maxPayloadSize?: number }} [options]
|
|
14320
14407
|
*/
|
|
14321
|
-
constructor(ws, extensions) {
|
|
14408
|
+
constructor(ws, extensions, options = {}) {
|
|
14322
14409
|
super();
|
|
14323
14410
|
this.ws = ws;
|
|
14324
14411
|
this.#extensions = extensions == null ? /* @__PURE__ */ new Map() : extensions;
|
|
14325
|
-
|
|
14412
|
+
this.#maxFragments = options.maxFragments ?? 0;
|
|
14413
|
+
this.#maxPayloadSize = options.maxPayloadSize ?? 0;
|
|
14414
|
+
if (this.#extensions.has("permessage-deflate")) this.#extensions.set("permessage-deflate", new PerMessageDeflate(extensions, options));
|
|
14326
14415
|
}
|
|
14327
14416
|
/**
|
|
14328
14417
|
* @param {Buffer} chunk
|
|
@@ -14334,6 +14423,13 @@ var require_receiver = /* @__PURE__ */ require_src.__commonJSMin(((exports, modu
|
|
|
14334
14423
|
this.#loop = true;
|
|
14335
14424
|
this.run(callback);
|
|
14336
14425
|
}
|
|
14426
|
+
#validatePayloadLength() {
|
|
14427
|
+
if (this.#maxPayloadSize > 0 && !isControlFrame(this.#info.opcode) && this.#info.payloadLength + this.#fragmentsBytes > this.#maxPayloadSize) {
|
|
14428
|
+
failWebsocketConnectionWithCode(this.ws, 1009, "Payload size exceeds maximum allowed size");
|
|
14429
|
+
return false;
|
|
14430
|
+
}
|
|
14431
|
+
return true;
|
|
14432
|
+
}
|
|
14337
14433
|
/**
|
|
14338
14434
|
* Runs whenever a new chunk is received.
|
|
14339
14435
|
* Callback is called whenever there are no more chunks buffering,
|
|
@@ -14390,6 +14486,7 @@ var require_receiver = /* @__PURE__ */ require_src.__commonJSMin(((exports, modu
|
|
|
14390
14486
|
if (payloadLength <= 125) {
|
|
14391
14487
|
this.#info.payloadLength = payloadLength;
|
|
14392
14488
|
this.#state = parserStates.READ_DATA;
|
|
14489
|
+
if (!this.#validatePayloadLength()) return;
|
|
14393
14490
|
} else if (payloadLength === 126) this.#state = parserStates.PAYLOADLENGTH_16;
|
|
14394
14491
|
else if (payloadLength === 127) this.#state = parserStates.PAYLOADLENGTH_64;
|
|
14395
14492
|
if (isTextBinaryFrame(opcode)) {
|
|
@@ -14405,6 +14502,7 @@ var require_receiver = /* @__PURE__ */ require_src.__commonJSMin(((exports, modu
|
|
|
14405
14502
|
const buffer = this.consume(2);
|
|
14406
14503
|
this.#info.payloadLength = buffer.readUInt16BE(0);
|
|
14407
14504
|
this.#state = parserStates.READ_DATA;
|
|
14505
|
+
if (!this.#validatePayloadLength()) return;
|
|
14408
14506
|
} else if (this.#state === parserStates.PAYLOADLENGTH_64) {
|
|
14409
14507
|
if (this.#byteOffset < 8) return callback();
|
|
14410
14508
|
const buffer = this.consume(8);
|
|
@@ -14416,6 +14514,7 @@ var require_receiver = /* @__PURE__ */ require_src.__commonJSMin(((exports, modu
|
|
|
14416
14514
|
}
|
|
14417
14515
|
this.#info.payloadLength = lower;
|
|
14418
14516
|
this.#state = parserStates.READ_DATA;
|
|
14517
|
+
if (!this.#validatePayloadLength()) return;
|
|
14419
14518
|
} else if (this.#state === parserStates.READ_DATA) {
|
|
14420
14519
|
if (this.#byteOffset < this.#info.payloadLength) return callback();
|
|
14421
14520
|
const body = this.consume(this.#info.payloadLength);
|
|
@@ -14423,30 +14522,34 @@ var require_receiver = /* @__PURE__ */ require_src.__commonJSMin(((exports, modu
|
|
|
14423
14522
|
this.#loop = this.parseControlFrame(body);
|
|
14424
14523
|
this.#state = parserStates.INFO;
|
|
14425
14524
|
} else if (!this.#info.compressed) {
|
|
14426
|
-
this
|
|
14427
|
-
if (
|
|
14428
|
-
|
|
14429
|
-
|
|
14430
|
-
this.#fragments.length = 0;
|
|
14525
|
+
if (!this.writeFragments(body)) return;
|
|
14526
|
+
if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
|
|
14527
|
+
failWebsocketConnectionWithCode(this.ws, 1009, new MessageSizeExceededError().message);
|
|
14528
|
+
return;
|
|
14431
14529
|
}
|
|
14530
|
+
if (!this.#info.fragmented && this.#info.fin) websocketMessageReceived(this.ws, this.#info.binaryType, this.consumeFragments());
|
|
14432
14531
|
this.#state = parserStates.INFO;
|
|
14433
14532
|
} else {
|
|
14434
14533
|
this.#extensions.get("permessage-deflate").decompress(body, this.#info.fin, (error, data) => {
|
|
14435
14534
|
if (error) {
|
|
14436
|
-
|
|
14535
|
+
const code = error instanceof MessageSizeExceededError ? 1009 : 1007;
|
|
14536
|
+
failWebsocketConnectionWithCode(this.ws, code, error.message);
|
|
14537
|
+
return;
|
|
14538
|
+
}
|
|
14539
|
+
if (!this.writeFragments(data)) return;
|
|
14540
|
+
if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
|
|
14541
|
+
failWebsocketConnectionWithCode(this.ws, 1009, new MessageSizeExceededError().message);
|
|
14437
14542
|
return;
|
|
14438
14543
|
}
|
|
14439
|
-
this.#fragments.push(data);
|
|
14440
14544
|
if (!this.#info.fin) {
|
|
14441
14545
|
this.#state = parserStates.INFO;
|
|
14442
14546
|
this.#loop = true;
|
|
14443
14547
|
this.run(callback);
|
|
14444
14548
|
return;
|
|
14445
14549
|
}
|
|
14446
|
-
websocketMessageReceived(this.ws, this.#info.binaryType,
|
|
14550
|
+
websocketMessageReceived(this.ws, this.#info.binaryType, this.consumeFragments());
|
|
14447
14551
|
this.#loop = true;
|
|
14448
14552
|
this.#state = parserStates.INFO;
|
|
14449
|
-
this.#fragments.length = 0;
|
|
14450
14553
|
this.run(callback);
|
|
14451
14554
|
});
|
|
14452
14555
|
this.#loop = false;
|
|
@@ -14486,6 +14589,26 @@ var require_receiver = /* @__PURE__ */ require_src.__commonJSMin(((exports, modu
|
|
|
14486
14589
|
this.#byteOffset -= n;
|
|
14487
14590
|
return buffer;
|
|
14488
14591
|
}
|
|
14592
|
+
writeFragments(fragment) {
|
|
14593
|
+
if (this.#maxFragments > 0 && this.#fragments.length === this.#maxFragments) {
|
|
14594
|
+
failWebsocketConnectionWithCode(this.ws, 1008, "Too many message fragments");
|
|
14595
|
+
return false;
|
|
14596
|
+
}
|
|
14597
|
+
this.#fragmentsBytes += fragment.length;
|
|
14598
|
+
this.#fragments.push(fragment);
|
|
14599
|
+
return true;
|
|
14600
|
+
}
|
|
14601
|
+
consumeFragments() {
|
|
14602
|
+
const fragments = this.#fragments;
|
|
14603
|
+
if (fragments.length === 1) {
|
|
14604
|
+
this.#fragmentsBytes = 0;
|
|
14605
|
+
return fragments.shift();
|
|
14606
|
+
}
|
|
14607
|
+
const output = Buffer.concat(fragments, this.#fragmentsBytes);
|
|
14608
|
+
this.#fragments = [];
|
|
14609
|
+
this.#fragmentsBytes = 0;
|
|
14610
|
+
return output;
|
|
14611
|
+
}
|
|
14489
14612
|
parseCloseBody(data) {
|
|
14490
14613
|
assert(data.length !== 1);
|
|
14491
14614
|
/** @type {number|undefined} */
|
|
@@ -14840,7 +14963,13 @@ var require_websocket = /* @__PURE__ */ require_src.__commonJSMin(((exports, mod
|
|
|
14840
14963
|
*/
|
|
14841
14964
|
#onConnectionEstablished(response, parsedExtensions) {
|
|
14842
14965
|
this[kResponse] = response;
|
|
14843
|
-
const
|
|
14966
|
+
const webSocketOptions = this[kController]?.dispatcher?.webSocketOptions;
|
|
14967
|
+
const maxFragments = webSocketOptions?.maxFragments;
|
|
14968
|
+
const maxPayloadSize = webSocketOptions?.maxPayloadSize;
|
|
14969
|
+
const parser = new ByteParser(this, parsedExtensions, {
|
|
14970
|
+
maxFragments,
|
|
14971
|
+
maxPayloadSize
|
|
14972
|
+
});
|
|
14844
14973
|
parser.on("drain", onParserDrain);
|
|
14845
14974
|
parser.on("error", onParserError.bind(this));
|
|
14846
14975
|
response.socket.ws = this;
|
package/lib/src.js
CHANGED
|
@@ -370,7 +370,7 @@ var import_valid = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((expo
|
|
|
370
370
|
})))());
|
|
371
371
|
const YES_MATCH_SCORE_THRESHOLD = 2;
|
|
372
372
|
const NO_MATCH_SCORE_THRESHOLD = 1.25;
|
|
373
|
-
const yMatch = new Map([
|
|
373
|
+
const yMatch = /* @__PURE__ */ new Map([
|
|
374
374
|
[5, .25],
|
|
375
375
|
[6, .25],
|
|
376
376
|
[7, .25],
|
|
@@ -381,7 +381,7 @@ const yMatch = new Map([
|
|
|
381
381
|
["h", .25],
|
|
382
382
|
["j", .25]
|
|
383
383
|
]);
|
|
384
|
-
const eMatch = new Map([
|
|
384
|
+
const eMatch = /* @__PURE__ */ new Map([
|
|
385
385
|
[2, .25],
|
|
386
386
|
[3, .25],
|
|
387
387
|
[4, .25],
|
|
@@ -392,7 +392,7 @@ const eMatch = new Map([
|
|
|
392
392
|
["d", .25],
|
|
393
393
|
["f", .25]
|
|
394
394
|
]);
|
|
395
|
-
const sMatch = new Map([
|
|
395
|
+
const sMatch = /* @__PURE__ */ new Map([
|
|
396
396
|
["q", .25],
|
|
397
397
|
["w", .25],
|
|
398
398
|
["e", .25],
|
|
@@ -403,7 +403,7 @@ const sMatch = new Map([
|
|
|
403
403
|
["x", .25],
|
|
404
404
|
["c", .25]
|
|
405
405
|
]);
|
|
406
|
-
const nMatch = new Map([
|
|
406
|
+
const nMatch = /* @__PURE__ */ new Map([
|
|
407
407
|
["h", .25],
|
|
408
408
|
["j", .25],
|
|
409
409
|
["k", .25],
|
|
@@ -411,7 +411,7 @@ const nMatch = new Map([
|
|
|
411
411
|
["n", 1],
|
|
412
412
|
["m", .75]
|
|
413
413
|
]);
|
|
414
|
-
const oMatch = new Map([
|
|
414
|
+
const oMatch = /* @__PURE__ */ new Map([
|
|
415
415
|
[9, .25],
|
|
416
416
|
[0, .25],
|
|
417
417
|
["i", .75],
|
|
@@ -454,22 +454,23 @@ function yn(value, { lenient: lenient$1 = false, default: default_ } = {}) {
|
|
|
454
454
|
//#endregion
|
|
455
455
|
//#region src/index.ts
|
|
456
456
|
const debuggingEnabled = yn(process.env.DEBUG) || yn(process.env.RUNNER_DEBUG);
|
|
457
|
-
const debug = debuggingEnabled ? (text) => {
|
|
458
|
-
console.log("::debug::" + text);
|
|
459
|
-
} : () => {};
|
|
460
457
|
function run(command) {
|
|
461
458
|
return new Promise((resolve, reject) => {
|
|
462
459
|
node_child_process.exec(command, (error, stdout, stderr) => {
|
|
463
|
-
debug("Run » " + command);
|
|
464
460
|
stdout = stdout.trim();
|
|
465
|
-
if (
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
461
|
+
if (debuggingEnabled) {
|
|
462
|
+
console.log("::debug::»" + command);
|
|
463
|
+
console.log("::debug::»", stdout);
|
|
464
|
+
}
|
|
465
|
+
if (error) {
|
|
466
|
+
if (!debuggingEnabled) {
|
|
467
|
+
console.log("»", command);
|
|
468
|
+
if (stdout.length > 0) console.log("»", stdout);
|
|
469
|
+
}
|
|
470
|
+
console.log("::error::»", error.message);
|
|
471
|
+
console.log(stderr.trimEnd());
|
|
469
472
|
reject(error);
|
|
470
|
-
});
|
|
471
|
-
else reject(error);
|
|
472
|
-
else resolve(stdout);
|
|
473
|
+
} else resolve(stdout);
|
|
473
474
|
});
|
|
474
475
|
});
|
|
475
476
|
}
|