Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions build/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,30 @@ const headRegexp = /(^module.exports = \w+;?)/m
/if \(typeof Symbol === 'function' && Symbol\.hasInstance\) \{/,
`if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {`
]
, addConstructors = [
headRegexp,
`$1\n\nfunction WriteReq(chunk, encoding, cb) {
this.chunk = chunk;
this.encoding = encoding;
this.callback = cb;
this.next = null;
}
// It seems a linked list but it is not
// there will be only 2 of these for each stream
function CorkedRequest(state) {
this.next = null;
this.entry = null;
this.finish = onCorkedFinish.bind(undefined, this, state);
}\n\n`
]
, useWriteReq = [
/state\.lastBufferedRequest = \{.+?\}/g,
`state.lastBufferedRequest = new WriteReq(chunk, encoding, cb)`
]
, useCorkedRequest = [
/var corkReq = [\s\S]+?(.+?)\.corkedRequestsFree = corkReq/g,
`$1.corkedRequestsFree = new CorkedRequest($1)`
]

module.exports['_stream_duplex.js'] = [
requireReplacement
Expand Down Expand Up @@ -261,6 +285,9 @@ module.exports['_stream_writable.js'] = [
, bufferShimFix
, bufferStaticMethods
, fixInstanceCheck
, addConstructors
, useWriteReq
, useCorkedRequest
]
module.exports['internal/streams/BufferList.js'] = [
bufferShimFix
Expand Down