web-streams-polyfill 3.1.1 → 3.2.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/CHANGELOG.md +7 -0
- package/README.md +6 -6
- package/dist/polyfill.es2018.js +41 -5
- package/dist/polyfill.es2018.js.map +1 -1
- package/dist/polyfill.es2018.min.js +1 -1
- package/dist/polyfill.es2018.min.js.map +1 -1
- package/dist/polyfill.es2018.mjs +41 -5
- package/dist/polyfill.es2018.mjs.map +1 -1
- package/dist/polyfill.es6.js +41 -5
- package/dist/polyfill.es6.js.map +1 -1
- package/dist/polyfill.es6.min.js +1 -1
- package/dist/polyfill.es6.min.js.map +1 -1
- package/dist/polyfill.es6.mjs +41 -5
- package/dist/polyfill.es6.mjs.map +1 -1
- package/dist/polyfill.js +41 -5
- package/dist/polyfill.js.map +1 -1
- package/dist/polyfill.min.js +1 -1
- package/dist/polyfill.min.js.map +1 -1
- package/dist/polyfill.mjs +41 -5
- package/dist/polyfill.mjs.map +1 -1
- package/dist/ponyfill.es2018.js +41 -5
- package/dist/ponyfill.es2018.js.map +1 -1
- package/dist/ponyfill.es2018.mjs +41 -5
- package/dist/ponyfill.es2018.mjs.map +1 -1
- package/dist/ponyfill.es6.js +41 -5
- package/dist/ponyfill.es6.js.map +1 -1
- package/dist/ponyfill.es6.mjs +41 -5
- package/dist/ponyfill.es6.mjs.map +1 -1
- package/dist/ponyfill.js +41 -5
- package/dist/ponyfill.js.map +1 -1
- package/dist/ponyfill.mjs +41 -5
- package/dist/ponyfill.mjs.map +1 -1
- package/dist/types/polyfill.d.ts +4 -0
- package/dist/types/ts3.6/polyfill.d.ts +4 -0
- package/package.json +1 -1
package/dist/ponyfill.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* web-streams-polyfill v3.
|
|
2
|
+
* web-streams-polyfill v3.2.0
|
|
3
3
|
*/
|
|
4
4
|
/// <reference lib="es2015.symbol" />
|
|
5
5
|
var SymbolPolyfill = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?
|
|
@@ -1237,6 +1237,9 @@ function ReadableByteStreamControllerEnqueue(controller, chunk) {
|
|
|
1237
1237
|
ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
|
|
1238
1238
|
}
|
|
1239
1239
|
else {
|
|
1240
|
+
if (controller._pendingPullIntos.length > 0) {
|
|
1241
|
+
ReadableByteStreamControllerShiftPendingPullInto(controller);
|
|
1242
|
+
}
|
|
1240
1243
|
var transferredView = new Uint8Array(transferredBuffer, byteOffset, byteLength);
|
|
1241
1244
|
ReadableStreamFulfillReadRequest(stream, transferredView, false);
|
|
1242
1245
|
}
|
|
@@ -1322,8 +1325,9 @@ function ReadableByteStreamControllerRespondWithNewView(controller, view) {
|
|
|
1322
1325
|
if (firstDescriptor.bytesFilled + view.byteLength > firstDescriptor.byteLength) {
|
|
1323
1326
|
throw new RangeError('The region specified by view is larger than byobRequest');
|
|
1324
1327
|
}
|
|
1328
|
+
var viewByteLength = view.byteLength;
|
|
1325
1329
|
firstDescriptor.buffer = TransferArrayBuffer(view.buffer);
|
|
1326
|
-
ReadableByteStreamControllerRespondInternal(controller,
|
|
1330
|
+
ReadableByteStreamControllerRespondInternal(controller, viewByteLength);
|
|
1327
1331
|
}
|
|
1328
1332
|
function SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize) {
|
|
1329
1333
|
controller._controlledReadableByteStream = stream;
|
|
@@ -2282,6 +2286,10 @@ var WritableStreamDefaultController = /** @class */ (function () {
|
|
|
2282
2286
|
Object.defineProperty(WritableStreamDefaultController.prototype, "abortReason", {
|
|
2283
2287
|
/**
|
|
2284
2288
|
* The reason which was passed to `WritableStream.abort(reason)` when the stream was aborted.
|
|
2289
|
+
*
|
|
2290
|
+
* @deprecated
|
|
2291
|
+
* This property has been removed from the specification, see https://github.com/whatwg/streams/pull/1177.
|
|
2292
|
+
* Use {@link WritableStreamDefaultController.signal}'s `reason` instead.
|
|
2285
2293
|
*/
|
|
2286
2294
|
get: function () {
|
|
2287
2295
|
if (!IsWritableStreamDefaultController(this)) {
|
|
@@ -2344,6 +2352,8 @@ var WritableStreamDefaultController = /** @class */ (function () {
|
|
|
2344
2352
|
return WritableStreamDefaultController;
|
|
2345
2353
|
}());
|
|
2346
2354
|
Object.defineProperties(WritableStreamDefaultController.prototype, {
|
|
2355
|
+
abortReason: { enumerable: true },
|
|
2356
|
+
signal: { enumerable: true },
|
|
2347
2357
|
error: { enumerable: true }
|
|
2348
2358
|
});
|
|
2349
2359
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
@@ -3092,6 +3102,7 @@ function ReadableStreamTee(stream, cloneForBranch2) {
|
|
|
3092
3102
|
function ReadableStreamDefaultTee(stream, cloneForBranch2) {
|
|
3093
3103
|
var reader = AcquireReadableStreamDefaultReader(stream);
|
|
3094
3104
|
var reading = false;
|
|
3105
|
+
var readAgain = false;
|
|
3095
3106
|
var canceled1 = false;
|
|
3096
3107
|
var canceled2 = false;
|
|
3097
3108
|
var reason1;
|
|
@@ -3104,6 +3115,7 @@ function ReadableStreamDefaultTee(stream, cloneForBranch2) {
|
|
|
3104
3115
|
});
|
|
3105
3116
|
function pullAlgorithm() {
|
|
3106
3117
|
if (reading) {
|
|
3118
|
+
readAgain = true;
|
|
3107
3119
|
return promiseResolvedWith(undefined);
|
|
3108
3120
|
}
|
|
3109
3121
|
reading = true;
|
|
@@ -3113,7 +3125,7 @@ function ReadableStreamDefaultTee(stream, cloneForBranch2) {
|
|
|
3113
3125
|
// reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let
|
|
3114
3126
|
// successful synchronously-available reads get ahead of asynchronously-available errors.
|
|
3115
3127
|
queueMicrotask(function () {
|
|
3116
|
-
|
|
3128
|
+
readAgain = false;
|
|
3117
3129
|
var chunk1 = chunk;
|
|
3118
3130
|
var chunk2 = chunk;
|
|
3119
3131
|
// There is no way to access the cloning code right now in the reference implementation.
|
|
@@ -3127,6 +3139,10 @@ function ReadableStreamDefaultTee(stream, cloneForBranch2) {
|
|
|
3127
3139
|
if (!canceled2) {
|
|
3128
3140
|
ReadableStreamDefaultControllerEnqueue(branch2._readableStreamController, chunk2);
|
|
3129
3141
|
}
|
|
3142
|
+
reading = false;
|
|
3143
|
+
if (readAgain) {
|
|
3144
|
+
pullAlgorithm();
|
|
3145
|
+
}
|
|
3130
3146
|
});
|
|
3131
3147
|
},
|
|
3132
3148
|
_closeSteps: function () {
|
|
@@ -3185,6 +3201,8 @@ function ReadableStreamDefaultTee(stream, cloneForBranch2) {
|
|
|
3185
3201
|
function ReadableByteStreamTee(stream) {
|
|
3186
3202
|
var reader = AcquireReadableStreamDefaultReader(stream);
|
|
3187
3203
|
var reading = false;
|
|
3204
|
+
var readAgainForBranch1 = false;
|
|
3205
|
+
var readAgainForBranch2 = false;
|
|
3188
3206
|
var canceled1 = false;
|
|
3189
3207
|
var canceled2 = false;
|
|
3190
3208
|
var reason1;
|
|
@@ -3219,7 +3237,8 @@ function ReadableByteStreamTee(stream) {
|
|
|
3219
3237
|
// reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let
|
|
3220
3238
|
// successful synchronously-available reads get ahead of asynchronously-available errors.
|
|
3221
3239
|
queueMicrotask(function () {
|
|
3222
|
-
|
|
3240
|
+
readAgainForBranch1 = false;
|
|
3241
|
+
readAgainForBranch2 = false;
|
|
3223
3242
|
var chunk1 = chunk;
|
|
3224
3243
|
var chunk2 = chunk;
|
|
3225
3244
|
if (!canceled1 && !canceled2) {
|
|
@@ -3239,6 +3258,13 @@ function ReadableByteStreamTee(stream) {
|
|
|
3239
3258
|
if (!canceled2) {
|
|
3240
3259
|
ReadableByteStreamControllerEnqueue(branch2._readableStreamController, chunk2);
|
|
3241
3260
|
}
|
|
3261
|
+
reading = false;
|
|
3262
|
+
if (readAgainForBranch1) {
|
|
3263
|
+
pull1Algorithm();
|
|
3264
|
+
}
|
|
3265
|
+
else if (readAgainForBranch2) {
|
|
3266
|
+
pull2Algorithm();
|
|
3267
|
+
}
|
|
3242
3268
|
});
|
|
3243
3269
|
},
|
|
3244
3270
|
_closeSteps: function () {
|
|
@@ -3279,7 +3305,8 @@ function ReadableByteStreamTee(stream) {
|
|
|
3279
3305
|
// reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let
|
|
3280
3306
|
// successful synchronously-available reads get ahead of asynchronously-available errors.
|
|
3281
3307
|
queueMicrotask(function () {
|
|
3282
|
-
|
|
3308
|
+
readAgainForBranch1 = false;
|
|
3309
|
+
readAgainForBranch2 = false;
|
|
3283
3310
|
var byobCanceled = forBranch2 ? canceled2 : canceled1;
|
|
3284
3311
|
var otherCanceled = forBranch2 ? canceled1 : canceled2;
|
|
3285
3312
|
if (!otherCanceled) {
|
|
@@ -3301,6 +3328,13 @@ function ReadableByteStreamTee(stream) {
|
|
|
3301
3328
|
else if (!byobCanceled) {
|
|
3302
3329
|
ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);
|
|
3303
3330
|
}
|
|
3331
|
+
reading = false;
|
|
3332
|
+
if (readAgainForBranch1) {
|
|
3333
|
+
pull1Algorithm();
|
|
3334
|
+
}
|
|
3335
|
+
else if (readAgainForBranch2) {
|
|
3336
|
+
pull2Algorithm();
|
|
3337
|
+
}
|
|
3304
3338
|
});
|
|
3305
3339
|
},
|
|
3306
3340
|
_closeSteps: function (chunk) {
|
|
@@ -3333,6 +3367,7 @@ function ReadableByteStreamTee(stream) {
|
|
|
3333
3367
|
}
|
|
3334
3368
|
function pull1Algorithm() {
|
|
3335
3369
|
if (reading) {
|
|
3370
|
+
readAgainForBranch1 = true;
|
|
3336
3371
|
return promiseResolvedWith(undefined);
|
|
3337
3372
|
}
|
|
3338
3373
|
reading = true;
|
|
@@ -3347,6 +3382,7 @@ function ReadableByteStreamTee(stream) {
|
|
|
3347
3382
|
}
|
|
3348
3383
|
function pull2Algorithm() {
|
|
3349
3384
|
if (reading) {
|
|
3385
|
+
readAgainForBranch2 = true;
|
|
3350
3386
|
return promiseResolvedWith(undefined);
|
|
3351
3387
|
}
|
|
3352
3388
|
reading = true;
|