web-streams-polyfill 3.0.2 → 3.0.3
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 -1
- package/README.md +6 -6
- package/dist/polyfill.es2018.js +30 -24
- 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 +29 -23
- package/dist/polyfill.es2018.mjs.map +1 -1
- package/dist/polyfill.es6.js +30 -24
- 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 +29 -23
- package/dist/polyfill.es6.mjs.map +1 -1
- package/dist/polyfill.js +30 -24
- 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 +29 -23
- package/dist/polyfill.mjs.map +1 -1
- package/dist/ponyfill.es2018.js +30 -24
- package/dist/ponyfill.es2018.js.map +1 -1
- package/dist/ponyfill.es2018.mjs +29 -23
- package/dist/ponyfill.es2018.mjs.map +1 -1
- package/dist/ponyfill.es6.js +30 -24
- package/dist/ponyfill.es6.js.map +1 -1
- package/dist/ponyfill.es6.mjs +29 -23
- package/dist/ponyfill.es6.mjs.map +1 -1
- package/dist/ponyfill.js +30 -24
- package/dist/ponyfill.js.map +1 -1
- package/dist/ponyfill.mjs +29 -23
- package/dist/ponyfill.mjs.map +1 -1
- package/dist/types/polyfill.d.ts +13 -13
- package/dist/types/ts3.6/polyfill.d.ts +13 -13
- package/dist/types/tsdoc-metadata.json +1 -1
- package/package.json +16 -16
package/dist/polyfill.es2018.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* web-streams-polyfill v3.0.
|
|
2
|
+
* web-streams-polyfill v3.0.3
|
|
3
3
|
*/
|
|
4
4
|
/// <reference lib="es2015.symbol" />
|
|
5
5
|
const SymbolPolyfill = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?
|
|
@@ -8,7 +8,7 @@ const SymbolPolyfill = typeof Symbol === 'function' && typeof Symbol.iterator ==
|
|
|
8
8
|
|
|
9
9
|
/// <reference lib="dom" />
|
|
10
10
|
function noop() {
|
|
11
|
-
|
|
11
|
+
return undefined;
|
|
12
12
|
}
|
|
13
13
|
function getGlobals() {
|
|
14
14
|
if (typeof self !== 'undefined') {
|
|
@@ -27,7 +27,7 @@ const globals = getGlobals();
|
|
|
27
27
|
function typeIsObject(x) {
|
|
28
28
|
return (typeof x === 'object' && x !== null) || typeof x === 'function';
|
|
29
29
|
}
|
|
30
|
-
const rethrowAssertionErrorRejection =
|
|
30
|
+
const rethrowAssertionErrorRejection = noop;
|
|
31
31
|
|
|
32
32
|
const originalPromise = Promise;
|
|
33
33
|
const originalPromiseThen = Promise.prototype.then;
|
|
@@ -1576,7 +1576,7 @@ class WritableStream {
|
|
|
1576
1576
|
*/
|
|
1577
1577
|
get locked() {
|
|
1578
1578
|
if (!IsWritableStream(this)) {
|
|
1579
|
-
throw streamBrandCheckException('locked');
|
|
1579
|
+
throw streamBrandCheckException$2('locked');
|
|
1580
1580
|
}
|
|
1581
1581
|
return IsWritableStreamLocked(this);
|
|
1582
1582
|
}
|
|
@@ -1591,7 +1591,7 @@ class WritableStream {
|
|
|
1591
1591
|
*/
|
|
1592
1592
|
abort(reason = undefined) {
|
|
1593
1593
|
if (!IsWritableStream(this)) {
|
|
1594
|
-
return promiseRejectedWith(streamBrandCheckException('abort'));
|
|
1594
|
+
return promiseRejectedWith(streamBrandCheckException$2('abort'));
|
|
1595
1595
|
}
|
|
1596
1596
|
if (IsWritableStreamLocked(this)) {
|
|
1597
1597
|
return promiseRejectedWith(new TypeError('Cannot abort a stream that already has a writer'));
|
|
@@ -1608,7 +1608,7 @@ class WritableStream {
|
|
|
1608
1608
|
*/
|
|
1609
1609
|
close() {
|
|
1610
1610
|
if (!IsWritableStream(this)) {
|
|
1611
|
-
return promiseRejectedWith(streamBrandCheckException('close'));
|
|
1611
|
+
return promiseRejectedWith(streamBrandCheckException$2('close'));
|
|
1612
1612
|
}
|
|
1613
1613
|
if (IsWritableStreamLocked(this)) {
|
|
1614
1614
|
return promiseRejectedWith(new TypeError('Cannot close a stream that already has a writer'));
|
|
@@ -1628,7 +1628,7 @@ class WritableStream {
|
|
|
1628
1628
|
*/
|
|
1629
1629
|
getWriter() {
|
|
1630
1630
|
if (!IsWritableStream(this)) {
|
|
1631
|
-
throw streamBrandCheckException('getWriter');
|
|
1631
|
+
throw streamBrandCheckException$2('getWriter');
|
|
1632
1632
|
}
|
|
1633
1633
|
return AcquireWritableStreamDefaultWriter(this);
|
|
1634
1634
|
}
|
|
@@ -2339,7 +2339,7 @@ function WritableStreamDefaultControllerError(controller, error) {
|
|
|
2339
2339
|
WritableStreamStartErroring(stream, error);
|
|
2340
2340
|
}
|
|
2341
2341
|
// Helper functions for the WritableStream.
|
|
2342
|
-
function streamBrandCheckException(name) {
|
|
2342
|
+
function streamBrandCheckException$2(name) {
|
|
2343
2343
|
return new TypeError(`WritableStream.prototype.${name} can only be used on a WritableStream`);
|
|
2344
2344
|
}
|
|
2345
2345
|
// Helper functions for the WritableStreamDefaultWriter.
|
|
@@ -2457,6 +2457,7 @@ function isDOMExceptionConstructor(ctor) {
|
|
|
2457
2457
|
}
|
|
2458
2458
|
}
|
|
2459
2459
|
function createDOMExceptionPolyfill() {
|
|
2460
|
+
// eslint-disable-next-line no-shadow
|
|
2460
2461
|
const ctor = function DOMException(message, name) {
|
|
2461
2462
|
this.message = message || '';
|
|
2462
2463
|
this.name = name || 'Error';
|
|
@@ -2468,6 +2469,7 @@ function createDOMExceptionPolyfill() {
|
|
|
2468
2469
|
Object.defineProperty(ctor.prototype, 'constructor', { value: ctor, writable: true, configurable: true });
|
|
2469
2470
|
return ctor;
|
|
2470
2471
|
}
|
|
2472
|
+
// eslint-disable-next-line no-redeclare
|
|
2471
2473
|
const DOMException$1 = isDOMExceptionConstructor(NativeDOMException) ? NativeDOMException : createDOMExceptionPolyfill();
|
|
2472
2474
|
|
|
2473
2475
|
function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventCancel, signal) {
|
|
@@ -2660,7 +2662,7 @@ class ReadableStreamDefaultController {
|
|
|
2660
2662
|
*/
|
|
2661
2663
|
get desiredSize() {
|
|
2662
2664
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2663
|
-
throw defaultControllerBrandCheckException('desiredSize');
|
|
2665
|
+
throw defaultControllerBrandCheckException$1('desiredSize');
|
|
2664
2666
|
}
|
|
2665
2667
|
return ReadableStreamDefaultControllerGetDesiredSize(this);
|
|
2666
2668
|
}
|
|
@@ -2670,7 +2672,7 @@ class ReadableStreamDefaultController {
|
|
|
2670
2672
|
*/
|
|
2671
2673
|
close() {
|
|
2672
2674
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2673
|
-
throw defaultControllerBrandCheckException('close');
|
|
2675
|
+
throw defaultControllerBrandCheckException$1('close');
|
|
2674
2676
|
}
|
|
2675
2677
|
if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)) {
|
|
2676
2678
|
throw new TypeError('The stream is not in a state that permits close');
|
|
@@ -2679,7 +2681,7 @@ class ReadableStreamDefaultController {
|
|
|
2679
2681
|
}
|
|
2680
2682
|
enqueue(chunk = undefined) {
|
|
2681
2683
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2682
|
-
throw defaultControllerBrandCheckException('enqueue');
|
|
2684
|
+
throw defaultControllerBrandCheckException$1('enqueue');
|
|
2683
2685
|
}
|
|
2684
2686
|
if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)) {
|
|
2685
2687
|
throw new TypeError('The stream is not in a state that permits enqueue');
|
|
@@ -2691,7 +2693,7 @@ class ReadableStreamDefaultController {
|
|
|
2691
2693
|
*/
|
|
2692
2694
|
error(e = undefined) {
|
|
2693
2695
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2694
|
-
throw defaultControllerBrandCheckException('error');
|
|
2696
|
+
throw defaultControllerBrandCheckException$1('error');
|
|
2695
2697
|
}
|
|
2696
2698
|
ReadableStreamDefaultControllerError(this, e);
|
|
2697
2699
|
}
|
|
@@ -2898,7 +2900,7 @@ function SetUpReadableStreamDefaultControllerFromUnderlyingSource(stream, underl
|
|
|
2898
2900
|
SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm);
|
|
2899
2901
|
}
|
|
2900
2902
|
// Helper functions for the ReadableStreamDefaultController.
|
|
2901
|
-
function defaultControllerBrandCheckException(name) {
|
|
2903
|
+
function defaultControllerBrandCheckException$1(name) {
|
|
2902
2904
|
return new TypeError(`ReadableStreamDefaultController.prototype.${name} can only be used on a ReadableStreamDefaultController`);
|
|
2903
2905
|
}
|
|
2904
2906
|
|
|
@@ -2940,7 +2942,6 @@ function ReadableStreamTee(stream, cloneForBranch2) {
|
|
|
2940
2942
|
if (!canceled2) {
|
|
2941
2943
|
ReadableStreamDefaultControllerEnqueue(branch2._readableStreamController, value2);
|
|
2942
2944
|
}
|
|
2943
|
-
resolveCancelPromise(undefined);
|
|
2944
2945
|
});
|
|
2945
2946
|
},
|
|
2946
2947
|
_closeSteps: () => {
|
|
@@ -2951,6 +2952,9 @@ function ReadableStreamTee(stream, cloneForBranch2) {
|
|
|
2951
2952
|
if (!canceled2) {
|
|
2952
2953
|
ReadableStreamDefaultControllerClose(branch2._readableStreamController);
|
|
2953
2954
|
}
|
|
2955
|
+
if (!canceled1 || !canceled2) {
|
|
2956
|
+
resolveCancelPromise(undefined);
|
|
2957
|
+
}
|
|
2954
2958
|
},
|
|
2955
2959
|
_errorSteps: () => {
|
|
2956
2960
|
reading = false;
|
|
@@ -2987,7 +2991,9 @@ function ReadableStreamTee(stream, cloneForBranch2) {
|
|
|
2987
2991
|
uponRejection(reader._closedPromise, (r) => {
|
|
2988
2992
|
ReadableStreamDefaultControllerError(branch1._readableStreamController, r);
|
|
2989
2993
|
ReadableStreamDefaultControllerError(branch2._readableStreamController, r);
|
|
2990
|
-
|
|
2994
|
+
if (!canceled1 || !canceled2) {
|
|
2995
|
+
resolveCancelPromise(undefined);
|
|
2996
|
+
}
|
|
2991
2997
|
});
|
|
2992
2998
|
return [branch1, branch2];
|
|
2993
2999
|
}
|
|
@@ -3529,7 +3535,7 @@ class TransformStream {
|
|
|
3529
3535
|
*/
|
|
3530
3536
|
get readable() {
|
|
3531
3537
|
if (!IsTransformStream(this)) {
|
|
3532
|
-
throw streamBrandCheckException
|
|
3538
|
+
throw streamBrandCheckException('readable');
|
|
3533
3539
|
}
|
|
3534
3540
|
return this._readable;
|
|
3535
3541
|
}
|
|
@@ -3538,7 +3544,7 @@ class TransformStream {
|
|
|
3538
3544
|
*/
|
|
3539
3545
|
get writable() {
|
|
3540
3546
|
if (!IsTransformStream(this)) {
|
|
3541
|
-
throw streamBrandCheckException
|
|
3547
|
+
throw streamBrandCheckException('writable');
|
|
3542
3548
|
}
|
|
3543
3549
|
return this._writable;
|
|
3544
3550
|
}
|
|
@@ -3631,14 +3637,14 @@ class TransformStreamDefaultController {
|
|
|
3631
3637
|
*/
|
|
3632
3638
|
get desiredSize() {
|
|
3633
3639
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3634
|
-
throw defaultControllerBrandCheckException
|
|
3640
|
+
throw defaultControllerBrandCheckException('desiredSize');
|
|
3635
3641
|
}
|
|
3636
3642
|
const readableController = this._controlledTransformStream._readable._readableStreamController;
|
|
3637
3643
|
return ReadableStreamDefaultControllerGetDesiredSize(readableController);
|
|
3638
3644
|
}
|
|
3639
3645
|
enqueue(chunk = undefined) {
|
|
3640
3646
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3641
|
-
throw defaultControllerBrandCheckException
|
|
3647
|
+
throw defaultControllerBrandCheckException('enqueue');
|
|
3642
3648
|
}
|
|
3643
3649
|
TransformStreamDefaultControllerEnqueue(this, chunk);
|
|
3644
3650
|
}
|
|
@@ -3648,7 +3654,7 @@ class TransformStreamDefaultController {
|
|
|
3648
3654
|
*/
|
|
3649
3655
|
error(reason = undefined) {
|
|
3650
3656
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3651
|
-
throw defaultControllerBrandCheckException
|
|
3657
|
+
throw defaultControllerBrandCheckException('error');
|
|
3652
3658
|
}
|
|
3653
3659
|
TransformStreamDefaultControllerError(this, reason);
|
|
3654
3660
|
}
|
|
@@ -3658,7 +3664,7 @@ class TransformStreamDefaultController {
|
|
|
3658
3664
|
*/
|
|
3659
3665
|
terminate() {
|
|
3660
3666
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3661
|
-
throw defaultControllerBrandCheckException
|
|
3667
|
+
throw defaultControllerBrandCheckException('terminate');
|
|
3662
3668
|
}
|
|
3663
3669
|
TransformStreamDefaultControllerTerminate(this);
|
|
3664
3670
|
}
|
|
@@ -3800,11 +3806,11 @@ function TransformStreamDefaultSourcePullAlgorithm(stream) {
|
|
|
3800
3806
|
return stream._backpressureChangePromise;
|
|
3801
3807
|
}
|
|
3802
3808
|
// Helper functions for the TransformStreamDefaultController.
|
|
3803
|
-
function defaultControllerBrandCheckException
|
|
3809
|
+
function defaultControllerBrandCheckException(name) {
|
|
3804
3810
|
return new TypeError(`TransformStreamDefaultController.prototype.${name} can only be used on a TransformStreamDefaultController`);
|
|
3805
3811
|
}
|
|
3806
3812
|
// Helper functions for the TransformStream.
|
|
3807
|
-
function streamBrandCheckException
|
|
3813
|
+
function streamBrandCheckException(name) {
|
|
3808
3814
|
return new TypeError(`TransformStream.prototype.${name} can only be used on a TransformStream`);
|
|
3809
3815
|
}
|
|
3810
3816
|
|