A big commit with a bunch of node modules so I could run puppeteer for Walmart. Added some todos and Headway's templates.
This commit is contained in:
3
Scripts/node_modules/streamx/README.md
generated
vendored
3
Scripts/node_modules/streamx/README.md
generated
vendored
@ -122,6 +122,9 @@ The default byteLength function returns the byte length of buffers and `1024`
|
||||
for any other object. This means the buffer will contain around 16 non buffers
|
||||
or buffers worth 16kb when full if the defaults are used.
|
||||
|
||||
If you set highWaterMark to `0` then all read ahead buffering on the stream
|
||||
is disabled and it will only call `_read` when a user reads rather than ahead of time.
|
||||
|
||||
#### `rs._read(cb)`
|
||||
|
||||
This function is called when the stream wants you to push new data.
|
||||
|
||||
80
Scripts/node_modules/streamx/index.js
generated
vendored
80
Scripts/node_modules/streamx/index.js
generated
vendored
@ -7,8 +7,8 @@ const FIFO = require('fast-fifo')
|
||||
|
||||
/* eslint-disable no-multi-spaces */
|
||||
|
||||
// 27 bits used total (4 from shared, 13 from read, and 10 from write)
|
||||
const MAX = ((1 << 27) - 1)
|
||||
// 28 bits used total (4 from shared, 14 from read, and 10 from write)
|
||||
const MAX = ((1 << 28) - 1)
|
||||
|
||||
// Shared state
|
||||
const OPENING = 0b0001
|
||||
@ -20,25 +20,27 @@ const NOT_OPENING = MAX ^ OPENING
|
||||
const NOT_PREDESTROYING = MAX ^ PREDESTROYING
|
||||
|
||||
// Read state (4 bit offset from shared state)
|
||||
const READ_ACTIVE = 0b0000000000001 << 4
|
||||
const READ_UPDATING = 0b0000000000010 << 4
|
||||
const READ_PRIMARY = 0b0000000000100 << 4
|
||||
const READ_QUEUED = 0b0000000001000 << 4
|
||||
const READ_RESUMED = 0b0000000010000 << 4
|
||||
const READ_PIPE_DRAINED = 0b0000000100000 << 4
|
||||
const READ_ENDING = 0b0000001000000 << 4
|
||||
const READ_EMIT_DATA = 0b0000010000000 << 4
|
||||
const READ_EMIT_READABLE = 0b0000100000000 << 4
|
||||
const READ_EMITTED_READABLE = 0b0001000000000 << 4
|
||||
const READ_DONE = 0b0010000000000 << 4
|
||||
const READ_NEXT_TICK = 0b0100000000000 << 4
|
||||
const READ_NEEDS_PUSH = 0b1000000000000 << 4
|
||||
const READ_ACTIVE = 0b00000000000001 << 4
|
||||
const READ_UPDATING = 0b00000000000010 << 4
|
||||
const READ_PRIMARY = 0b00000000000100 << 4
|
||||
const READ_QUEUED = 0b00000000001000 << 4
|
||||
const READ_RESUMED = 0b00000000010000 << 4
|
||||
const READ_PIPE_DRAINED = 0b00000000100000 << 4
|
||||
const READ_ENDING = 0b00000001000000 << 4
|
||||
const READ_EMIT_DATA = 0b00000010000000 << 4
|
||||
const READ_EMIT_READABLE = 0b00000100000000 << 4
|
||||
const READ_EMITTED_READABLE = 0b00001000000000 << 4
|
||||
const READ_DONE = 0b00010000000000 << 4
|
||||
const READ_NEXT_TICK = 0b00100000000000 << 4
|
||||
const READ_NEEDS_PUSH = 0b01000000000000 << 4
|
||||
const READ_READ_AHEAD = 0b10000000000000 << 4
|
||||
|
||||
// Combined read state
|
||||
const READ_FLOWING = READ_RESUMED | READ_PIPE_DRAINED
|
||||
const READ_ACTIVE_AND_NEEDS_PUSH = READ_ACTIVE | READ_NEEDS_PUSH
|
||||
const READ_PRIMARY_AND_ACTIVE = READ_PRIMARY | READ_ACTIVE
|
||||
const READ_EMIT_READABLE_AND_QUEUED = READ_EMIT_READABLE | READ_QUEUED
|
||||
const READ_RESUMED_READ_AHEAD = READ_RESUMED | READ_READ_AHEAD
|
||||
|
||||
const READ_NOT_ACTIVE = MAX ^ READ_ACTIVE
|
||||
const READ_NON_PRIMARY = MAX ^ READ_PRIMARY
|
||||
@ -50,18 +52,20 @@ const READ_NOT_ENDING = MAX ^ READ_ENDING
|
||||
const READ_PIPE_NOT_DRAINED = MAX ^ READ_FLOWING
|
||||
const READ_NOT_NEXT_TICK = MAX ^ READ_NEXT_TICK
|
||||
const READ_NOT_UPDATING = MAX ^ READ_UPDATING
|
||||
const READ_NO_READ_AHEAD = MAX ^ READ_READ_AHEAD
|
||||
const READ_PAUSED_NO_READ_AHEAD = MAX ^ READ_RESUMED_READ_AHEAD
|
||||
|
||||
// Write state (17 bit offset, 4 bit offset from shared state and 13 from read state)
|
||||
const WRITE_ACTIVE = 0b0000000001 << 17
|
||||
const WRITE_UPDATING = 0b0000000010 << 17
|
||||
const WRITE_PRIMARY = 0b0000000100 << 17
|
||||
const WRITE_QUEUED = 0b0000001000 << 17
|
||||
const WRITE_UNDRAINED = 0b0000010000 << 17
|
||||
const WRITE_DONE = 0b0000100000 << 17
|
||||
const WRITE_EMIT_DRAIN = 0b0001000000 << 17
|
||||
const WRITE_NEXT_TICK = 0b0010000000 << 17
|
||||
const WRITE_WRITING = 0b0100000000 << 17
|
||||
const WRITE_FINISHING = 0b1000000000 << 17
|
||||
// Write state (18 bit offset, 4 bit offset from shared state and 13 from read state)
|
||||
const WRITE_ACTIVE = 0b0000000001 << 18
|
||||
const WRITE_UPDATING = 0b0000000010 << 18
|
||||
const WRITE_PRIMARY = 0b0000000100 << 18
|
||||
const WRITE_QUEUED = 0b0000001000 << 18
|
||||
const WRITE_UNDRAINED = 0b0000010000 << 18
|
||||
const WRITE_DONE = 0b0000100000 << 18
|
||||
const WRITE_EMIT_DRAIN = 0b0001000000 << 18
|
||||
const WRITE_NEXT_TICK = 0b0010000000 << 18
|
||||
const WRITE_WRITING = 0b0100000000 << 18
|
||||
const WRITE_FINISHING = 0b1000000000 << 18
|
||||
|
||||
const WRITE_NOT_ACTIVE = MAX ^ (WRITE_ACTIVE | WRITE_WRITING)
|
||||
const WRITE_NON_PRIMARY = MAX ^ WRITE_PRIMARY
|
||||
@ -88,7 +92,7 @@ const READ_PRIMARY_STATUS = OPEN_STATUS | READ_ENDING | READ_DONE
|
||||
const READ_STATUS = OPEN_STATUS | READ_DONE | READ_QUEUED
|
||||
const READ_ENDING_STATUS = OPEN_STATUS | READ_ENDING | READ_QUEUED
|
||||
const READ_READABLE_STATUS = OPEN_STATUS | READ_EMIT_READABLE | READ_QUEUED | READ_EMITTED_READABLE
|
||||
const SHOULD_NOT_READ = OPEN_STATUS | READ_ACTIVE | READ_ENDING | READ_DONE | READ_NEEDS_PUSH
|
||||
const SHOULD_NOT_READ = OPEN_STATUS | READ_ACTIVE | READ_ENDING | READ_DONE | READ_NEEDS_PUSH | READ_READ_AHEAD
|
||||
const READ_BACKPRESSURE_STATUS = DESTROY_STATUS | READ_ENDING | READ_DONE
|
||||
const READ_UPDATE_SYNC_STATUS = READ_UPDATING | OPEN_STATUS | READ_NEXT_TICK | READ_PRIMARY
|
||||
|
||||
@ -231,8 +235,9 @@ class ReadableState {
|
||||
constructor (stream, { highWaterMark = 16384, map = null, mapReadable, byteLength, byteLengthReadable } = {}) {
|
||||
this.stream = stream
|
||||
this.queue = new FIFO()
|
||||
this.highWaterMark = highWaterMark
|
||||
this.highWaterMark = highWaterMark === 0 ? 1 : highWaterMark
|
||||
this.buffered = 0
|
||||
this.readAhead = highWaterMark > 0
|
||||
this.error = null
|
||||
this.pipeline = null
|
||||
this.byteLength = byteLengthReadable || byteLength || defaultByteLength
|
||||
@ -322,6 +327,11 @@ class ReadableState {
|
||||
return data
|
||||
}
|
||||
|
||||
if (this.readAhead === false) {
|
||||
stream._duplexState |= READ_READ_AHEAD
|
||||
this.updateNextTick()
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
@ -343,7 +353,7 @@ class ReadableState {
|
||||
do {
|
||||
this.drain()
|
||||
|
||||
while (this.buffered < this.highWaterMark && (stream._duplexState & SHOULD_NOT_READ) === 0) {
|
||||
while (this.buffered < this.highWaterMark && (stream._duplexState & SHOULD_NOT_READ) === READ_READ_AHEAD) {
|
||||
stream._duplexState |= READ_ACTIVE_AND_NEEDS_PUSH
|
||||
stream._read(this.afterRead)
|
||||
this.drain()
|
||||
@ -516,6 +526,7 @@ function afterWrite (err) {
|
||||
function afterRead (err) {
|
||||
if (err) this.stream.destroy(err)
|
||||
this.stream._duplexState &= READ_NOT_ACTIVE
|
||||
if (this.readAhead === false && (this.stream._duplexState & READ_RESUMED) === 0) this.stream._duplexState &= READ_NO_READ_AHEAD
|
||||
this.updateCallback()
|
||||
}
|
||||
|
||||
@ -573,7 +584,7 @@ function afterTransform (err, data) {
|
||||
function newListener (name) {
|
||||
if (this._readableState !== null) {
|
||||
if (name === 'data') {
|
||||
this._duplexState |= (READ_EMIT_DATA | READ_RESUMED)
|
||||
this._duplexState |= (READ_EMIT_DATA | READ_RESUMED_READ_AHEAD)
|
||||
this._readableState.updateNextTick()
|
||||
}
|
||||
if (name === 'readable') {
|
||||
@ -666,10 +677,11 @@ class Readable extends Stream {
|
||||
constructor (opts) {
|
||||
super(opts)
|
||||
|
||||
this._duplexState |= OPENING | WRITE_DONE
|
||||
this._duplexState |= OPENING | WRITE_DONE | READ_READ_AHEAD
|
||||
this._readableState = new ReadableState(this, opts)
|
||||
|
||||
if (opts) {
|
||||
if (this._readableState.readAhead === false) this._duplexState &= READ_NO_READ_AHEAD
|
||||
if (opts.read) this._read = opts.read
|
||||
if (opts.eagerOpen) this._readableState.updateNextTick()
|
||||
}
|
||||
@ -701,13 +713,13 @@ class Readable extends Stream {
|
||||
}
|
||||
|
||||
resume () {
|
||||
this._duplexState |= READ_RESUMED
|
||||
this._duplexState |= READ_RESUMED_READ_AHEAD
|
||||
this._readableState.updateNextTick()
|
||||
return this
|
||||
}
|
||||
|
||||
pause () {
|
||||
this._duplexState &= READ_PAUSED
|
||||
this._duplexState &= (this._readableState.readAhead === false ? READ_PAUSED_NO_READ_AHEAD : READ_PAUSED)
|
||||
return this
|
||||
}
|
||||
|
||||
@ -879,7 +891,7 @@ class Duplex extends Readable { // and Writable
|
||||
constructor (opts) {
|
||||
super(opts)
|
||||
|
||||
this._duplexState = OPENING
|
||||
this._duplexState = OPENING | (this._duplexState & READ_READ_AHEAD)
|
||||
this._writableState = new WritableState(this, opts)
|
||||
|
||||
if (opts) {
|
||||
|
||||
11
Scripts/node_modules/streamx/package.json
generated
vendored
11
Scripts/node_modules/streamx/package.json
generated
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "streamx",
|
||||
"version": "2.15.6",
|
||||
"version": "2.16.1",
|
||||
"description": "An iteration of the Node.js core streams with a series of improvements",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
@ -12,9 +12,18 @@
|
||||
"end-of-stream": "^1.4.4",
|
||||
"standard": "^17.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"bare-events": "^2.2.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"imports": {
|
||||
"events": {
|
||||
"bare": "bare-events",
|
||||
"default": "events"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && brittle test/*.js"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user