web-streams-polyfill 3.1.0 → 3.2.1
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/README.md +6 -6
- package/dist/polyfill.es2018.js +61 -13
- 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 +61 -13
- package/dist/polyfill.es2018.mjs.map +1 -1
- package/dist/polyfill.es6.js +61 -13
- 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 +61 -13
- package/dist/polyfill.es6.mjs.map +1 -1
- package/dist/polyfill.js +61 -13
- 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 +61 -13
- package/dist/polyfill.mjs.map +1 -1
- package/dist/ponyfill.es2018.js +61 -13
- package/dist/ponyfill.es2018.js.map +1 -1
- package/dist/ponyfill.es2018.mjs +61 -13
- package/dist/ponyfill.es2018.mjs.map +1 -1
- package/dist/ponyfill.es6.js +61 -13
- package/dist/ponyfill.es6.js.map +1 -1
- package/dist/ponyfill.es6.mjs +61 -13
- package/dist/ponyfill.es6.mjs.map +1 -1
- package/dist/ponyfill.js +61 -13
- package/dist/ponyfill.js.map +1 -1
- package/dist/ponyfill.mjs +61 -13
- package/dist/ponyfill.mjs.map +1 -1
- package/dist/types/polyfill.d.ts +18 -11
- package/dist/types/ts3.6/polyfill.d.ts +18 -11
- package/package.json +1 -1
- package/CHANGELOG.md +0 -123
package/dist/ponyfill.es6.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* web-streams-polyfill v3.1
|
|
2
|
+
* web-streams-polyfill v3.2.1
|
|
3
3
|
*/
|
|
4
4
|
(function (global, factory) {
|
|
5
5
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -1212,6 +1212,9 @@
|
|
|
1212
1212
|
ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
|
|
1213
1213
|
}
|
|
1214
1214
|
else {
|
|
1215
|
+
if (controller._pendingPullIntos.length > 0) {
|
|
1216
|
+
ReadableByteStreamControllerShiftPendingPullInto(controller);
|
|
1217
|
+
}
|
|
1215
1218
|
const transferredView = new Uint8Array(transferredBuffer, byteOffset, byteLength);
|
|
1216
1219
|
ReadableStreamFulfillReadRequest(stream, transferredView, false);
|
|
1217
1220
|
}
|
|
@@ -1297,8 +1300,9 @@
|
|
|
1297
1300
|
if (firstDescriptor.bytesFilled + view.byteLength > firstDescriptor.byteLength) {
|
|
1298
1301
|
throw new RangeError('The region specified by view is larger than byobRequest');
|
|
1299
1302
|
}
|
|
1303
|
+
const viewByteLength = view.byteLength;
|
|
1300
1304
|
firstDescriptor.buffer = TransferArrayBuffer(view.buffer);
|
|
1301
|
-
ReadableByteStreamControllerRespondInternal(controller,
|
|
1305
|
+
ReadableByteStreamControllerRespondInternal(controller, viewByteLength);
|
|
1302
1306
|
}
|
|
1303
1307
|
function SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize) {
|
|
1304
1308
|
controller._controlledReadableByteStream = stream;
|
|
@@ -2225,6 +2229,10 @@
|
|
|
2225
2229
|
}
|
|
2226
2230
|
/**
|
|
2227
2231
|
* The reason which was passed to `WritableStream.abort(reason)` when the stream was aborted.
|
|
2232
|
+
*
|
|
2233
|
+
* @deprecated
|
|
2234
|
+
* This property has been removed from the specification, see https://github.com/whatwg/streams/pull/1177.
|
|
2235
|
+
* Use {@link WritableStreamDefaultController.signal}'s `reason` instead.
|
|
2228
2236
|
*/
|
|
2229
2237
|
get abortReason() {
|
|
2230
2238
|
if (!IsWritableStreamDefaultController(this)) {
|
|
@@ -2278,6 +2286,8 @@
|
|
|
2278
2286
|
}
|
|
2279
2287
|
}
|
|
2280
2288
|
Object.defineProperties(WritableStreamDefaultController.prototype, {
|
|
2289
|
+
abortReason: { enumerable: true },
|
|
2290
|
+
signal: { enumerable: true },
|
|
2281
2291
|
error: { enumerable: true }
|
|
2282
2292
|
});
|
|
2283
2293
|
if (typeof SymbolPolyfill.toStringTag === 'symbol') {
|
|
@@ -3019,6 +3029,7 @@
|
|
|
3019
3029
|
function ReadableStreamDefaultTee(stream, cloneForBranch2) {
|
|
3020
3030
|
const reader = AcquireReadableStreamDefaultReader(stream);
|
|
3021
3031
|
let reading = false;
|
|
3032
|
+
let readAgain = false;
|
|
3022
3033
|
let canceled1 = false;
|
|
3023
3034
|
let canceled2 = false;
|
|
3024
3035
|
let reason1;
|
|
@@ -3031,6 +3042,7 @@
|
|
|
3031
3042
|
});
|
|
3032
3043
|
function pullAlgorithm() {
|
|
3033
3044
|
if (reading) {
|
|
3045
|
+
readAgain = true;
|
|
3034
3046
|
return promiseResolvedWith(undefined);
|
|
3035
3047
|
}
|
|
3036
3048
|
reading = true;
|
|
@@ -3040,7 +3052,7 @@
|
|
|
3040
3052
|
// reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let
|
|
3041
3053
|
// successful synchronously-available reads get ahead of asynchronously-available errors.
|
|
3042
3054
|
queueMicrotask(() => {
|
|
3043
|
-
|
|
3055
|
+
readAgain = false;
|
|
3044
3056
|
const chunk1 = chunk;
|
|
3045
3057
|
const chunk2 = chunk;
|
|
3046
3058
|
// There is no way to access the cloning code right now in the reference implementation.
|
|
@@ -3054,6 +3066,10 @@
|
|
|
3054
3066
|
if (!canceled2) {
|
|
3055
3067
|
ReadableStreamDefaultControllerEnqueue(branch2._readableStreamController, chunk2);
|
|
3056
3068
|
}
|
|
3069
|
+
reading = false;
|
|
3070
|
+
if (readAgain) {
|
|
3071
|
+
pullAlgorithm();
|
|
3072
|
+
}
|
|
3057
3073
|
});
|
|
3058
3074
|
},
|
|
3059
3075
|
_closeSteps: () => {
|
|
@@ -3112,6 +3128,8 @@
|
|
|
3112
3128
|
function ReadableByteStreamTee(stream) {
|
|
3113
3129
|
let reader = AcquireReadableStreamDefaultReader(stream);
|
|
3114
3130
|
let reading = false;
|
|
3131
|
+
let readAgainForBranch1 = false;
|
|
3132
|
+
let readAgainForBranch2 = false;
|
|
3115
3133
|
let canceled1 = false;
|
|
3116
3134
|
let canceled2 = false;
|
|
3117
3135
|
let reason1;
|
|
@@ -3146,7 +3164,8 @@
|
|
|
3146
3164
|
// reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let
|
|
3147
3165
|
// successful synchronously-available reads get ahead of asynchronously-available errors.
|
|
3148
3166
|
queueMicrotask(() => {
|
|
3149
|
-
|
|
3167
|
+
readAgainForBranch1 = false;
|
|
3168
|
+
readAgainForBranch2 = false;
|
|
3150
3169
|
const chunk1 = chunk;
|
|
3151
3170
|
let chunk2 = chunk;
|
|
3152
3171
|
if (!canceled1 && !canceled2) {
|
|
@@ -3166,6 +3185,13 @@
|
|
|
3166
3185
|
if (!canceled2) {
|
|
3167
3186
|
ReadableByteStreamControllerEnqueue(branch2._readableStreamController, chunk2);
|
|
3168
3187
|
}
|
|
3188
|
+
reading = false;
|
|
3189
|
+
if (readAgainForBranch1) {
|
|
3190
|
+
pull1Algorithm();
|
|
3191
|
+
}
|
|
3192
|
+
else if (readAgainForBranch2) {
|
|
3193
|
+
pull2Algorithm();
|
|
3194
|
+
}
|
|
3169
3195
|
});
|
|
3170
3196
|
},
|
|
3171
3197
|
_closeSteps: () => {
|
|
@@ -3206,7 +3232,8 @@
|
|
|
3206
3232
|
// reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let
|
|
3207
3233
|
// successful synchronously-available reads get ahead of asynchronously-available errors.
|
|
3208
3234
|
queueMicrotask(() => {
|
|
3209
|
-
|
|
3235
|
+
readAgainForBranch1 = false;
|
|
3236
|
+
readAgainForBranch2 = false;
|
|
3210
3237
|
const byobCanceled = forBranch2 ? canceled2 : canceled1;
|
|
3211
3238
|
const otherCanceled = forBranch2 ? canceled1 : canceled2;
|
|
3212
3239
|
if (!otherCanceled) {
|
|
@@ -3228,6 +3255,13 @@
|
|
|
3228
3255
|
else if (!byobCanceled) {
|
|
3229
3256
|
ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);
|
|
3230
3257
|
}
|
|
3258
|
+
reading = false;
|
|
3259
|
+
if (readAgainForBranch1) {
|
|
3260
|
+
pull1Algorithm();
|
|
3261
|
+
}
|
|
3262
|
+
else if (readAgainForBranch2) {
|
|
3263
|
+
pull2Algorithm();
|
|
3264
|
+
}
|
|
3231
3265
|
});
|
|
3232
3266
|
},
|
|
3233
3267
|
_closeSteps: chunk => {
|
|
@@ -3260,6 +3294,7 @@
|
|
|
3260
3294
|
}
|
|
3261
3295
|
function pull1Algorithm() {
|
|
3262
3296
|
if (reading) {
|
|
3297
|
+
readAgainForBranch1 = true;
|
|
3263
3298
|
return promiseResolvedWith(undefined);
|
|
3264
3299
|
}
|
|
3265
3300
|
reading = true;
|
|
@@ -3274,6 +3309,7 @@
|
|
|
3274
3309
|
}
|
|
3275
3310
|
function pull2Algorithm() {
|
|
3276
3311
|
if (reading) {
|
|
3312
|
+
readAgainForBranch2 = true;
|
|
3277
3313
|
return promiseResolvedWith(undefined);
|
|
3278
3314
|
}
|
|
3279
3315
|
reading = true;
|
|
@@ -3677,10 +3713,16 @@
|
|
|
3677
3713
|
const byteLengthSizeFunction = (chunk) => {
|
|
3678
3714
|
return chunk.byteLength;
|
|
3679
3715
|
};
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3716
|
+
try {
|
|
3717
|
+
Object.defineProperty(byteLengthSizeFunction, 'name', {
|
|
3718
|
+
value: 'size',
|
|
3719
|
+
configurable: true
|
|
3720
|
+
});
|
|
3721
|
+
}
|
|
3722
|
+
catch (_a) {
|
|
3723
|
+
// This property is non-configurable in older browsers, so ignore if this throws.
|
|
3724
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name#browser_compatibility
|
|
3725
|
+
}
|
|
3684
3726
|
/**
|
|
3685
3727
|
* A queuing strategy that counts the number of bytes in each chunk.
|
|
3686
3728
|
*
|
|
@@ -3739,10 +3781,16 @@
|
|
|
3739
3781
|
const countSizeFunction = () => {
|
|
3740
3782
|
return 1;
|
|
3741
3783
|
};
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3784
|
+
try {
|
|
3785
|
+
Object.defineProperty(countSizeFunction, 'name', {
|
|
3786
|
+
value: 'size',
|
|
3787
|
+
configurable: true
|
|
3788
|
+
});
|
|
3789
|
+
}
|
|
3790
|
+
catch (_a) {
|
|
3791
|
+
// This property is non-configurable in older browsers, so ignore if this throws.
|
|
3792
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name#browser_compatibility
|
|
3793
|
+
}
|
|
3746
3794
|
/**
|
|
3747
3795
|
* A queuing strategy that counts the number of chunks.
|
|
3748
3796
|
*
|