build: update distribution (#2921)

This commit is contained in:
actions-bot 2024-05-28 14:21:15 +01:00 committed by GitHub
parent b67febc3a3
commit b5ed4c38bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

126
dist/index.js vendored
View file

@ -28097,10 +28097,6 @@ Reflect.deleteProperty(Headers, 'setHeadersGuard')
Reflect.deleteProperty(Headers, 'getHeadersList')
Reflect.deleteProperty(Headers, 'setHeadersList')
Object.defineProperty(Headers.prototype, util.inspect.custom, {
enumerable: false
})
iteratorMixin('Headers', Headers, kHeadersSortedMap, 0, 1)
Object.defineProperties(Headers.prototype, {
@ -28113,6 +28109,17 @@ Object.defineProperties(Headers.prototype, {
[Symbol.toStringTag]: {
value: 'Headers',
configurable: true
},
[util.inspect.custom]: {
enumerable: false
},
// Compatibility for global headers
[Symbol('headers list')]: {
configurable: false,
enumerable: false,
get: function () {
return getHeadersList(this)
}
}
})
@ -36828,8 +36835,8 @@ class ByteParser extends Writable {
this.#loop = true
this.#state = parserStates.INFO
this.run(callback)
this.#fragments.length = 0
this.run(callback)
})
this.#loop = false
@ -37022,15 +37029,30 @@ module.exports = {
const { WebsocketFrameSend } = __nccwpck_require__(2391)
const { opcodes, sendHints } = __nccwpck_require__(3587)
const FixedQueue = __nccwpck_require__(5158)
/** @type {Uint8Array} */
/** @type {typeof Uint8Array} */
const FastBuffer = Buffer[Symbol.species]
class SendQueue {
#queued = new Set()
#size = 0
/**
* @typedef {object} SendQueueNode
* @property {Promise<void> | null} promise
* @property {((...args: any[]) => any)} callback
* @property {Buffer | null} frame
*/
/** @type {import('net').Socket} */
class SendQueue {
/**
* @type {FixedQueue}
*/
#queue = new FixedQueue()
/**
* @type {boolean}
*/
#running = false
/** @type {import('node:net').Socket} */
#socket
constructor (socket) {
@ -37039,58 +37061,62 @@ class SendQueue {
add (item, cb, hint) {
if (hint !== sendHints.blob) {
const data = clone(item, hint)
if (this.#size === 0) {
this.#dispatch(data, cb, hint)
const frame = createFrame(item, hint)
if (!this.#running) {
// fast-path
this.#socket.write(frame, cb)
} else {
this.#queued.add([data, cb, true, hint])
this.#size++
this.#run()
/** @type {SendQueueNode} */
const node = {
promise: null,
callback: cb,
frame
}
this.#queue.push(node)
}
return
}
const promise = item.arrayBuffer()
const queue = [null, cb, false, hint]
promise.then((ab) => {
queue[0] = clone(ab, hint)
queue[2] = true
/** @type {SendQueueNode} */
const node = {
promise: item.arrayBuffer().then((ab) => {
node.promise = null
node.frame = createFrame(ab, hint)
}),
callback: cb,
frame: null
}
this.#queue.push(node)
if (!this.#running) {
this.#run()
})
this.#queued.add(queue)
this.#size++
}
#run () {
for (const queued of this.#queued) {
const [data, cb, done, hint] = queued
if (!done) return
this.#queued.delete(queued)
this.#size--
this.#dispatch(data, cb, hint)
}
}
#dispatch (data, cb, hint) {
const frame = new WebsocketFrameSend()
const opcode = hint === sendHints.string ? opcodes.TEXT : opcodes.BINARY
frame.frameData = data
const buffer = frame.createFrame(opcode)
this.#socket.write(buffer, cb)
async #run () {
this.#running = true
const queue = this.#queue
while (!queue.isEmpty()) {
const node = queue.shift()
// wait pending promise
if (node.promise !== null) {
await node.promise
}
// write
this.#socket.write(node.frame, node.callback)
// cleanup
node.callback = node.frame = null
}
this.#running = false
}
}
function clone (data, hint) {
function createFrame (data, hint) {
return new WebsocketFrameSend(toBuffer(data, hint)).createFrame(hint === sendHints.string ? opcodes.TEXT : opcodes.BINARY)
}
function toBuffer (data, hint) {
switch (hint) {
case sendHints.string:
return Buffer.from(data)
@ -37098,7 +37124,7 @@ function clone (data, hint) {
case sendHints.blob:
return new FastBuffer(data)
case sendHints.typedArray:
return Buffer.copyBytesFrom(data)
return new FastBuffer(data.buffer, data.byteOffset, data.byteLength)
}
}