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.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* web-streams-polyfill v3.0.
|
|
2
|
+
* web-streams-polyfill v3.0.3
|
|
3
3
|
*/
|
|
4
4
|
(function (global, factory) {
|
|
5
5
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
6
6
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
7
|
-
(global = global || self, factory(global.WebStreamsPolyfill = {}));
|
|
7
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.WebStreamsPolyfill = {}));
|
|
8
8
|
}(this, (function (exports) { 'use strict';
|
|
9
9
|
|
|
10
10
|
/// <reference lib="es2015.symbol" />
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
/// <reference lib="dom" />
|
|
16
16
|
function noop() {
|
|
17
|
-
|
|
17
|
+
return undefined;
|
|
18
18
|
}
|
|
19
19
|
function getGlobals() {
|
|
20
20
|
if (typeof self !== 'undefined') {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
function typeIsObject(x) {
|
|
34
34
|
return (typeof x === 'object' && x !== null) || typeof x === 'function';
|
|
35
35
|
}
|
|
36
|
-
var rethrowAssertionErrorRejection =
|
|
36
|
+
var rethrowAssertionErrorRejection = noop;
|
|
37
37
|
|
|
38
38
|
var originalPromise = Promise;
|
|
39
39
|
var originalPromiseThen = Promise.prototype.then;
|
|
@@ -1633,7 +1633,7 @@
|
|
|
1633
1633
|
*/
|
|
1634
1634
|
get: function () {
|
|
1635
1635
|
if (!IsWritableStream(this)) {
|
|
1636
|
-
throw streamBrandCheckException('locked');
|
|
1636
|
+
throw streamBrandCheckException$2('locked');
|
|
1637
1637
|
}
|
|
1638
1638
|
return IsWritableStreamLocked(this);
|
|
1639
1639
|
},
|
|
@@ -1652,7 +1652,7 @@
|
|
|
1652
1652
|
WritableStream.prototype.abort = function (reason) {
|
|
1653
1653
|
if (reason === void 0) { reason = undefined; }
|
|
1654
1654
|
if (!IsWritableStream(this)) {
|
|
1655
|
-
return promiseRejectedWith(streamBrandCheckException('abort'));
|
|
1655
|
+
return promiseRejectedWith(streamBrandCheckException$2('abort'));
|
|
1656
1656
|
}
|
|
1657
1657
|
if (IsWritableStreamLocked(this)) {
|
|
1658
1658
|
return promiseRejectedWith(new TypeError('Cannot abort a stream that already has a writer'));
|
|
@@ -1669,7 +1669,7 @@
|
|
|
1669
1669
|
*/
|
|
1670
1670
|
WritableStream.prototype.close = function () {
|
|
1671
1671
|
if (!IsWritableStream(this)) {
|
|
1672
|
-
return promiseRejectedWith(streamBrandCheckException('close'));
|
|
1672
|
+
return promiseRejectedWith(streamBrandCheckException$2('close'));
|
|
1673
1673
|
}
|
|
1674
1674
|
if (IsWritableStreamLocked(this)) {
|
|
1675
1675
|
return promiseRejectedWith(new TypeError('Cannot close a stream that already has a writer'));
|
|
@@ -1689,7 +1689,7 @@
|
|
|
1689
1689
|
*/
|
|
1690
1690
|
WritableStream.prototype.getWriter = function () {
|
|
1691
1691
|
if (!IsWritableStream(this)) {
|
|
1692
|
-
throw streamBrandCheckException('getWriter');
|
|
1692
|
+
throw streamBrandCheckException$2('getWriter');
|
|
1693
1693
|
}
|
|
1694
1694
|
return AcquireWritableStreamDefaultWriter(this);
|
|
1695
1695
|
};
|
|
@@ -2420,7 +2420,7 @@
|
|
|
2420
2420
|
WritableStreamStartErroring(stream, error);
|
|
2421
2421
|
}
|
|
2422
2422
|
// Helper functions for the WritableStream.
|
|
2423
|
-
function streamBrandCheckException(name) {
|
|
2423
|
+
function streamBrandCheckException$2(name) {
|
|
2424
2424
|
return new TypeError("WritableStream.prototype." + name + " can only be used on a WritableStream");
|
|
2425
2425
|
}
|
|
2426
2426
|
// Helper functions for the WritableStreamDefaultWriter.
|
|
@@ -2538,6 +2538,7 @@
|
|
|
2538
2538
|
}
|
|
2539
2539
|
}
|
|
2540
2540
|
function createDOMExceptionPolyfill() {
|
|
2541
|
+
// eslint-disable-next-line no-shadow
|
|
2541
2542
|
var ctor = function DOMException(message, name) {
|
|
2542
2543
|
this.message = message || '';
|
|
2543
2544
|
this.name = name || 'Error';
|
|
@@ -2549,6 +2550,7 @@
|
|
|
2549
2550
|
Object.defineProperty(ctor.prototype, 'constructor', { value: ctor, writable: true, configurable: true });
|
|
2550
2551
|
return ctor;
|
|
2551
2552
|
}
|
|
2553
|
+
// eslint-disable-next-line no-redeclare
|
|
2552
2554
|
var DOMException$1 = isDOMExceptionConstructor(NativeDOMException) ? NativeDOMException : createDOMExceptionPolyfill();
|
|
2553
2555
|
|
|
2554
2556
|
function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventCancel, signal) {
|
|
@@ -2742,7 +2744,7 @@
|
|
|
2742
2744
|
*/
|
|
2743
2745
|
get: function () {
|
|
2744
2746
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2745
|
-
throw defaultControllerBrandCheckException('desiredSize');
|
|
2747
|
+
throw defaultControllerBrandCheckException$1('desiredSize');
|
|
2746
2748
|
}
|
|
2747
2749
|
return ReadableStreamDefaultControllerGetDesiredSize(this);
|
|
2748
2750
|
},
|
|
@@ -2755,7 +2757,7 @@
|
|
|
2755
2757
|
*/
|
|
2756
2758
|
ReadableStreamDefaultController.prototype.close = function () {
|
|
2757
2759
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2758
|
-
throw defaultControllerBrandCheckException('close');
|
|
2760
|
+
throw defaultControllerBrandCheckException$1('close');
|
|
2759
2761
|
}
|
|
2760
2762
|
if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)) {
|
|
2761
2763
|
throw new TypeError('The stream is not in a state that permits close');
|
|
@@ -2765,7 +2767,7 @@
|
|
|
2765
2767
|
ReadableStreamDefaultController.prototype.enqueue = function (chunk) {
|
|
2766
2768
|
if (chunk === void 0) { chunk = undefined; }
|
|
2767
2769
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2768
|
-
throw defaultControllerBrandCheckException('enqueue');
|
|
2770
|
+
throw defaultControllerBrandCheckException$1('enqueue');
|
|
2769
2771
|
}
|
|
2770
2772
|
if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)) {
|
|
2771
2773
|
throw new TypeError('The stream is not in a state that permits enqueue');
|
|
@@ -2778,7 +2780,7 @@
|
|
|
2778
2780
|
ReadableStreamDefaultController.prototype.error = function (e) {
|
|
2779
2781
|
if (e === void 0) { e = undefined; }
|
|
2780
2782
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2781
|
-
throw defaultControllerBrandCheckException('error');
|
|
2783
|
+
throw defaultControllerBrandCheckException$1('error');
|
|
2782
2784
|
}
|
|
2783
2785
|
ReadableStreamDefaultControllerError(this, e);
|
|
2784
2786
|
};
|
|
@@ -2986,7 +2988,7 @@
|
|
|
2986
2988
|
SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm);
|
|
2987
2989
|
}
|
|
2988
2990
|
// Helper functions for the ReadableStreamDefaultController.
|
|
2989
|
-
function defaultControllerBrandCheckException(name) {
|
|
2991
|
+
function defaultControllerBrandCheckException$1(name) {
|
|
2990
2992
|
return new TypeError("ReadableStreamDefaultController.prototype." + name + " can only be used on a ReadableStreamDefaultController");
|
|
2991
2993
|
}
|
|
2992
2994
|
|
|
@@ -3028,7 +3030,6 @@
|
|
|
3028
3030
|
if (!canceled2) {
|
|
3029
3031
|
ReadableStreamDefaultControllerEnqueue(branch2._readableStreamController, value2);
|
|
3030
3032
|
}
|
|
3031
|
-
resolveCancelPromise(undefined);
|
|
3032
3033
|
});
|
|
3033
3034
|
},
|
|
3034
3035
|
_closeSteps: function () {
|
|
@@ -3039,6 +3040,9 @@
|
|
|
3039
3040
|
if (!canceled2) {
|
|
3040
3041
|
ReadableStreamDefaultControllerClose(branch2._readableStreamController);
|
|
3041
3042
|
}
|
|
3043
|
+
if (!canceled1 || !canceled2) {
|
|
3044
|
+
resolveCancelPromise(undefined);
|
|
3045
|
+
}
|
|
3042
3046
|
},
|
|
3043
3047
|
_errorSteps: function () {
|
|
3044
3048
|
reading = false;
|
|
@@ -3075,7 +3079,9 @@
|
|
|
3075
3079
|
uponRejection(reader._closedPromise, function (r) {
|
|
3076
3080
|
ReadableStreamDefaultControllerError(branch1._readableStreamController, r);
|
|
3077
3081
|
ReadableStreamDefaultControllerError(branch2._readableStreamController, r);
|
|
3078
|
-
|
|
3082
|
+
if (!canceled1 || !canceled2) {
|
|
3083
|
+
resolveCancelPromise(undefined);
|
|
3084
|
+
}
|
|
3079
3085
|
});
|
|
3080
3086
|
return [branch1, branch2];
|
|
3081
3087
|
}
|
|
@@ -3653,7 +3659,7 @@
|
|
|
3653
3659
|
*/
|
|
3654
3660
|
get: function () {
|
|
3655
3661
|
if (!IsTransformStream(this)) {
|
|
3656
|
-
throw streamBrandCheckException
|
|
3662
|
+
throw streamBrandCheckException('readable');
|
|
3657
3663
|
}
|
|
3658
3664
|
return this._readable;
|
|
3659
3665
|
},
|
|
@@ -3666,7 +3672,7 @@
|
|
|
3666
3672
|
*/
|
|
3667
3673
|
get: function () {
|
|
3668
3674
|
if (!IsTransformStream(this)) {
|
|
3669
|
-
throw streamBrandCheckException
|
|
3675
|
+
throw streamBrandCheckException('writable');
|
|
3670
3676
|
}
|
|
3671
3677
|
return this._writable;
|
|
3672
3678
|
},
|
|
@@ -3764,7 +3770,7 @@
|
|
|
3764
3770
|
*/
|
|
3765
3771
|
get: function () {
|
|
3766
3772
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3767
|
-
throw defaultControllerBrandCheckException
|
|
3773
|
+
throw defaultControllerBrandCheckException('desiredSize');
|
|
3768
3774
|
}
|
|
3769
3775
|
var readableController = this._controlledTransformStream._readable._readableStreamController;
|
|
3770
3776
|
return ReadableStreamDefaultControllerGetDesiredSize(readableController);
|
|
@@ -3775,7 +3781,7 @@
|
|
|
3775
3781
|
TransformStreamDefaultController.prototype.enqueue = function (chunk) {
|
|
3776
3782
|
if (chunk === void 0) { chunk = undefined; }
|
|
3777
3783
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3778
|
-
throw defaultControllerBrandCheckException
|
|
3784
|
+
throw defaultControllerBrandCheckException('enqueue');
|
|
3779
3785
|
}
|
|
3780
3786
|
TransformStreamDefaultControllerEnqueue(this, chunk);
|
|
3781
3787
|
};
|
|
@@ -3786,7 +3792,7 @@
|
|
|
3786
3792
|
TransformStreamDefaultController.prototype.error = function (reason) {
|
|
3787
3793
|
if (reason === void 0) { reason = undefined; }
|
|
3788
3794
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3789
|
-
throw defaultControllerBrandCheckException
|
|
3795
|
+
throw defaultControllerBrandCheckException('error');
|
|
3790
3796
|
}
|
|
3791
3797
|
TransformStreamDefaultControllerError(this, reason);
|
|
3792
3798
|
};
|
|
@@ -3796,7 +3802,7 @@
|
|
|
3796
3802
|
*/
|
|
3797
3803
|
TransformStreamDefaultController.prototype.terminate = function () {
|
|
3798
3804
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3799
|
-
throw defaultControllerBrandCheckException
|
|
3805
|
+
throw defaultControllerBrandCheckException('terminate');
|
|
3800
3806
|
}
|
|
3801
3807
|
TransformStreamDefaultControllerTerminate(this);
|
|
3802
3808
|
};
|
|
@@ -3939,11 +3945,11 @@
|
|
|
3939
3945
|
return stream._backpressureChangePromise;
|
|
3940
3946
|
}
|
|
3941
3947
|
// Helper functions for the TransformStreamDefaultController.
|
|
3942
|
-
function defaultControllerBrandCheckException
|
|
3948
|
+
function defaultControllerBrandCheckException(name) {
|
|
3943
3949
|
return new TypeError("TransformStreamDefaultController.prototype." + name + " can only be used on a TransformStreamDefaultController");
|
|
3944
3950
|
}
|
|
3945
3951
|
// Helper functions for the TransformStream.
|
|
3946
|
-
function streamBrandCheckException
|
|
3952
|
+
function streamBrandCheckException(name) {
|
|
3947
3953
|
return new TypeError("TransformStream.prototype." + name + " can only be used on a TransformStream");
|
|
3948
3954
|
}
|
|
3949
3955
|
|