Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

bare-stream

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bare-stream - npm Package Compare versions

Comparing version
2.13.0
to
2.13.1
+31
global.d.ts
import * as web from './web'
declare global {
type ReadableStream = web.ReadableStream
type ReadableStreamDefaultController = web.ReadableStreamDefaultController
type ReadableStreamDefaultReader = web.ReadableStreamDefaultReader
type CountQueuingStrategy = web.CountQueuingStrategy
type ByteLengthQueuingStrategy = web.ByteLengthQueuingStrategy
type WritableStream = web.WritableStream
type WritableStreamDefaultController = web.WritableStreamDefaultController
type WritableStreamDefaultWriter = web.WritableStreamDefaultWriter
type TransformStream = web.TransformStream
type TransformStreamDefaultController = web.TransformStreamDefaultController
const ReadableStream: typeof web.ReadableStream
const ReadableStreamDefaultController: typeof web.ReadableStreamDefaultController
const ReadableStreamDefaultReader: typeof web.ReadableStreamDefaultReader
const CountQueuingStrategy: typeof web.CountQueuingStrategy
const ByteLengthQueuingStrategy: typeof web.ByteLengthQueuingStrategy
const WritableStream: typeof web.WritableStream
const WritableStreamDefaultController: typeof web.WritableStreamDefaultController
const WritableStreamDefaultWriter: typeof web.WritableStreamDefaultWriter
const TransformStream: typeof web.TransformStream
const TransformStreamDefaultController: typeof web.TransformStreamDefaultController
}
+4
-1

@@ -12,2 +12,5 @@ const stream = require('./web')

global.WritableStreamDefaultController = stream.WritableStreamDefaultController
global.WritableStreamDefaultReader = stream.WritableStreamDefaultReader
global.WritableStreamDefaultWriter = stream.WritableStreamDefaultWriter
global.TransformStream = stream.TransformStream
global.TransformStreamDefaultController = stream.TransformStreamDefaultController
+1
-1

@@ -290,3 +290,3 @@ const stream = require('streamx')

const readable = exports.Readable.fromWeb(readableStream, opts)
const writable = exports.Readable.fromWeb(writableStream, opts)
const writable = exports.Writable.fromWeb(writableStream, opts)

@@ -293,0 +293,0 @@ const duplex = new exports.Duplex({

{
"name": "bare-stream",
"version": "2.13.0",
"version": "2.13.1",
"description": "Streaming data for JavaScript",

@@ -16,3 +16,6 @@ "exports": {

},
"./global": "./global.js"
"./global": {
"types": "./global.d.ts",
"default": "./global.js"
}
},

@@ -25,3 +28,4 @@ "files": [

"web.d.ts",
"global.js"
"global.js",
"global.d.ts"
],

@@ -28,0 +32,0 @@ "scripts": {

+59
-59

@@ -144,12 +144,16 @@ const { Readable, Writable, Transform, getStreamError, isStreamx, isDisturbed } = require('streamx')

if (start) {
this._stream._open = this._open.bind(this, start.call(this, controller))
}
try {
let starting = Promise.resolve()
if (pull) {
this._stream._read = this._read.bind(this, pull.bind(this, controller))
}
if (start) starting = forwardError(start.call(this, controller), controller)
if (cancel) {
this._stream.once('error', cancel)
if (pull) {
this._stream._read = this._read.bind(this, starting, pull.bind(this, controller))
}
if (cancel) {
this._stream.once('error', cancel.bind(this))
}
} catch (err) {
controller.error(err)
}

@@ -211,13 +215,5 @@ }

async _open(starting, cb) {
let err = null
try {
await starting
} catch (e) {
err = e
}
cb(err)
}
async _read(starting, pull, cb) {
await starting
async _read(pull, cb) {
let err = null

@@ -392,18 +388,24 @@ try {

this._controller = new exports.WritableStreamDefaultController(this)
const controller = new exports.WritableStreamDefaultController(this)
if (start) {
this._stream._open = this._open.bind(this, start.call(this, this._controller))
}
this._controller = controller
if (write) {
this._stream._write = this._write.bind(this, write)
}
try {
let starting = Promise.resolve()
if (close) {
this._stream._destroy = this._destroy.bind(this, close.call(this))
}
if (start) starting = forwardError(start.call(this, controller), controller)
if (abort) {
this._stream.once('error', abort)
if (write) {
this._stream._write = this._write.bind(this, starting, write.bind(this))
}
if (close) {
this._stream._destroy = this._destroy.bind(this, close.call(this))
}
if (abort) {
this._stream.once('error', abort.bind(this))
}
} catch (err) {
controller.error(err)
}

@@ -451,13 +453,5 @@ }

async _open(starting, cb) {
let err = null
try {
await starting
} catch (e) {
err = e
}
cb(err)
}
async _write(starting, write, data, cb) {
await starting
async _write(write, data, cb) {
let err = null

@@ -537,14 +531,20 @@ try {

this._controller = new exports.TransformStreamDefaultController(this)
const controller = new exports.TransformStreamDefaultController(this)
if (start) {
this._stream._open = this._open.bind(this, start.call(this, this._controller))
}
this._controller = controller
if (transform) {
this._stream._write = this._transform.bind(this, transform)
}
try {
let starting = Promise.resolve()
if (flush) {
this._stream._flush = this._flush.bind(this, flush.call(this, this._controller))
if (start) starting = forwardError(start.call(this, controller), controller)
if (transform) {
this._stream._transform = this._transform.bind(this, starting, transform.bind(this))
}
if (flush) {
this._stream._flush = this._flush.bind(this, flush.call(this, this._controller))
}
} catch (err) {
controller.error(err)
}

@@ -569,13 +569,5 @@ }

async _open(starting, cb) {
let err = null
try {
await starting
} catch (e) {
err = e
}
cb(err)
}
async _transform(starting, transform, data, cb) {
await starting
async _transform(transform, data, cb) {
let err = null

@@ -613,2 +605,10 @@ try {

async function forwardError(promise, controller) {
try {
await promise
} catch (err) {
controller.error(err)
}
}
function noop() {}