web-streams-polyfill 3.3.1 → 3.3.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/README.md +0 -1
- package/dist/polyfill.es2018.js +49 -51
- package/dist/polyfill.es2018.js.map +1 -1
- package/dist/polyfill.es2018.min.js +2 -2
- package/dist/polyfill.es2018.min.js.map +1 -1
- package/dist/polyfill.es2018.mjs +49 -51
- package/dist/polyfill.es2018.mjs.map +1 -1
- package/dist/polyfill.es6.js +180 -186
- package/dist/polyfill.es6.js.map +1 -1
- package/dist/polyfill.es6.min.js +2 -2
- package/dist/polyfill.es6.min.js.map +1 -1
- package/dist/polyfill.es6.mjs +180 -186
- package/dist/polyfill.es6.mjs.map +1 -1
- package/dist/polyfill.js +139 -140
- package/dist/polyfill.js.map +1 -1
- package/dist/polyfill.min.js +2 -2
- package/dist/polyfill.min.js.map +1 -1
- package/dist/polyfill.mjs +139 -140
- package/dist/polyfill.mjs.map +1 -1
- package/dist/ponyfill.es2018.js +49 -51
- package/dist/ponyfill.es2018.js.map +1 -1
- package/dist/ponyfill.es2018.mjs +49 -51
- package/dist/ponyfill.es2018.mjs.map +1 -1
- package/dist/ponyfill.es6.js +180 -186
- package/dist/ponyfill.es6.js.map +1 -1
- package/dist/ponyfill.es6.mjs +180 -186
- package/dist/ponyfill.es6.mjs.map +1 -1
- package/dist/ponyfill.js +139 -140
- package/dist/ponyfill.js.map +1 -1
- package/dist/ponyfill.mjs +139 -140
- package/dist/ponyfill.mjs.map +1 -1
- package/dist/types/polyfill.d.ts +24 -0
- package/dist/types/ponyfill.d.ts +3 -3
- package/dist/types/ts3.6/polyfill.d.ts +28 -0
- package/dist/types/ts3.6/ponyfill.d.ts +3 -3
- package/package.json +1 -1
package/dist/polyfill.es2018.mjs
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* web-streams-polyfill v3.3.
|
|
3
|
+
* web-streams-polyfill v3.3.3
|
|
4
4
|
* Copyright 2024 Mattias Buelens, Diwank Singh Tomer and other contributors.
|
|
5
5
|
* This code is released under the MIT license.
|
|
6
6
|
* SPDX-License-Identifier: MIT
|
|
7
7
|
*/
|
|
8
|
-
/// <reference lib="es2015.symbol" />
|
|
9
|
-
const SymbolPolyfill = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?
|
|
10
|
-
Symbol :
|
|
11
|
-
description => `Symbol(${description})`;
|
|
12
|
-
|
|
13
8
|
function noop() {
|
|
14
9
|
return undefined;
|
|
15
10
|
}
|
|
@@ -202,11 +197,11 @@ class SimpleQueue {
|
|
|
202
197
|
}
|
|
203
198
|
}
|
|
204
199
|
|
|
205
|
-
const AbortSteps =
|
|
206
|
-
const ErrorSteps =
|
|
207
|
-
const CancelSteps =
|
|
208
|
-
const PullSteps =
|
|
209
|
-
const ReleaseSteps =
|
|
200
|
+
const AbortSteps = Symbol('[[AbortSteps]]');
|
|
201
|
+
const ErrorSteps = Symbol('[[ErrorSteps]]');
|
|
202
|
+
const CancelSteps = Symbol('[[CancelSteps]]');
|
|
203
|
+
const PullSteps = Symbol('[[PullSteps]]');
|
|
204
|
+
const ReleaseSteps = Symbol('[[ReleaseSteps]]');
|
|
210
205
|
|
|
211
206
|
function ReadableStreamReaderGenericInitialize(reader, stream) {
|
|
212
207
|
reader._ownerReadableStream = stream;
|
|
@@ -486,8 +481,8 @@ Object.defineProperties(ReadableStreamDefaultReader.prototype, {
|
|
|
486
481
|
setFunctionName(ReadableStreamDefaultReader.prototype.cancel, 'cancel');
|
|
487
482
|
setFunctionName(ReadableStreamDefaultReader.prototype.read, 'read');
|
|
488
483
|
setFunctionName(ReadableStreamDefaultReader.prototype.releaseLock, 'releaseLock');
|
|
489
|
-
if (typeof
|
|
490
|
-
Object.defineProperty(ReadableStreamDefaultReader.prototype,
|
|
484
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
485
|
+
Object.defineProperty(ReadableStreamDefaultReader.prototype, Symbol.toStringTag, {
|
|
491
486
|
value: 'ReadableStreamDefaultReader',
|
|
492
487
|
configurable: true
|
|
493
488
|
});
|
|
@@ -620,9 +615,7 @@ const ReadableStreamAsyncIteratorPrototype = {
|
|
|
620
615
|
return this._asyncIteratorImpl.return(value);
|
|
621
616
|
}
|
|
622
617
|
};
|
|
623
|
-
|
|
624
|
-
Object.setPrototypeOf(ReadableStreamAsyncIteratorPrototype, AsyncIteratorPrototype);
|
|
625
|
-
}
|
|
618
|
+
Object.setPrototypeOf(ReadableStreamAsyncIteratorPrototype, AsyncIteratorPrototype);
|
|
626
619
|
// Abstract operations for the ReadableStream.
|
|
627
620
|
function AcquireReadableStreamAsyncIterator(stream, preventCancel) {
|
|
628
621
|
const reader = AcquireReadableStreamDefaultReader(stream);
|
|
@@ -659,6 +652,7 @@ const NumberIsNaN = Number.isNaN || function (x) {
|
|
|
659
652
|
return x !== x;
|
|
660
653
|
};
|
|
661
654
|
|
|
655
|
+
var _a, _b, _c;
|
|
662
656
|
function CreateArrayFromList(elements) {
|
|
663
657
|
// We use arrays to represent lists, so this is basically a no-op.
|
|
664
658
|
// Do a slice though just in case we happen to depend on the unique-ness.
|
|
@@ -716,7 +710,7 @@ function CreateAsyncFromSyncIterator(syncIteratorRecord) {
|
|
|
716
710
|
// we use yield* inside an async generator function to achieve the same result.
|
|
717
711
|
// Wrap the sync iterator inside a sync iterable, so we can use it with yield*.
|
|
718
712
|
const syncIterable = {
|
|
719
|
-
[
|
|
713
|
+
[Symbol.iterator]: () => syncIteratorRecord.iterator
|
|
720
714
|
};
|
|
721
715
|
// Create an async generator function and immediately invoke it.
|
|
722
716
|
const asyncIterator = (async function* () {
|
|
@@ -726,18 +720,20 @@ function CreateAsyncFromSyncIterator(syncIteratorRecord) {
|
|
|
726
720
|
const nextMethod = asyncIterator.next;
|
|
727
721
|
return { iterator: asyncIterator, nextMethod, done: false };
|
|
728
722
|
}
|
|
723
|
+
// Aligns with core-js/modules/es.symbol.async-iterator.js
|
|
724
|
+
const SymbolAsyncIterator = (_c = (_a = Symbol.asyncIterator) !== null && _a !== void 0 ? _a : (_b = Symbol.for) === null || _b === void 0 ? void 0 : _b.call(Symbol, 'Symbol.asyncIterator')) !== null && _c !== void 0 ? _c : '@@asyncIterator';
|
|
729
725
|
function GetIterator(obj, hint = 'sync', method) {
|
|
730
726
|
if (method === undefined) {
|
|
731
727
|
if (hint === 'async') {
|
|
732
|
-
method = GetMethod(obj,
|
|
728
|
+
method = GetMethod(obj, SymbolAsyncIterator);
|
|
733
729
|
if (method === undefined) {
|
|
734
|
-
const syncMethod = GetMethod(obj,
|
|
730
|
+
const syncMethod = GetMethod(obj, Symbol.iterator);
|
|
735
731
|
const syncIteratorRecord = GetIterator(obj, 'sync', syncMethod);
|
|
736
732
|
return CreateAsyncFromSyncIterator(syncIteratorRecord);
|
|
737
733
|
}
|
|
738
734
|
}
|
|
739
735
|
else {
|
|
740
|
-
method = GetMethod(obj,
|
|
736
|
+
method = GetMethod(obj, Symbol.iterator);
|
|
741
737
|
}
|
|
742
738
|
}
|
|
743
739
|
if (method === undefined) {
|
|
@@ -874,8 +870,8 @@ Object.defineProperties(ReadableStreamBYOBRequest.prototype, {
|
|
|
874
870
|
});
|
|
875
871
|
setFunctionName(ReadableStreamBYOBRequest.prototype.respond, 'respond');
|
|
876
872
|
setFunctionName(ReadableStreamBYOBRequest.prototype.respondWithNewView, 'respondWithNewView');
|
|
877
|
-
if (typeof
|
|
878
|
-
Object.defineProperty(ReadableStreamBYOBRequest.prototype,
|
|
873
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
874
|
+
Object.defineProperty(ReadableStreamBYOBRequest.prototype, Symbol.toStringTag, {
|
|
879
875
|
value: 'ReadableStreamBYOBRequest',
|
|
880
876
|
configurable: true
|
|
881
877
|
});
|
|
@@ -1018,8 +1014,8 @@ Object.defineProperties(ReadableByteStreamController.prototype, {
|
|
|
1018
1014
|
setFunctionName(ReadableByteStreamController.prototype.close, 'close');
|
|
1019
1015
|
setFunctionName(ReadableByteStreamController.prototype.enqueue, 'enqueue');
|
|
1020
1016
|
setFunctionName(ReadableByteStreamController.prototype.error, 'error');
|
|
1021
|
-
if (typeof
|
|
1022
|
-
Object.defineProperty(ReadableByteStreamController.prototype,
|
|
1017
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
1018
|
+
Object.defineProperty(ReadableByteStreamController.prototype, Symbol.toStringTag, {
|
|
1023
1019
|
value: 'ReadableByteStreamController',
|
|
1024
1020
|
configurable: true
|
|
1025
1021
|
});
|
|
@@ -1707,8 +1703,8 @@ Object.defineProperties(ReadableStreamBYOBReader.prototype, {
|
|
|
1707
1703
|
setFunctionName(ReadableStreamBYOBReader.prototype.cancel, 'cancel');
|
|
1708
1704
|
setFunctionName(ReadableStreamBYOBReader.prototype.read, 'read');
|
|
1709
1705
|
setFunctionName(ReadableStreamBYOBReader.prototype.releaseLock, 'releaseLock');
|
|
1710
|
-
if (typeof
|
|
1711
|
-
Object.defineProperty(ReadableStreamBYOBReader.prototype,
|
|
1706
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
1707
|
+
Object.defineProperty(ReadableStreamBYOBReader.prototype, Symbol.toStringTag, {
|
|
1712
1708
|
value: 'ReadableStreamBYOBReader',
|
|
1713
1709
|
configurable: true
|
|
1714
1710
|
});
|
|
@@ -1948,8 +1944,8 @@ Object.defineProperties(WritableStream.prototype, {
|
|
|
1948
1944
|
setFunctionName(WritableStream.prototype.abort, 'abort');
|
|
1949
1945
|
setFunctionName(WritableStream.prototype.close, 'close');
|
|
1950
1946
|
setFunctionName(WritableStream.prototype.getWriter, 'getWriter');
|
|
1951
|
-
if (typeof
|
|
1952
|
-
Object.defineProperty(WritableStream.prototype,
|
|
1947
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
1948
|
+
Object.defineProperty(WritableStream.prototype, Symbol.toStringTag, {
|
|
1953
1949
|
value: 'WritableStream',
|
|
1954
1950
|
configurable: true
|
|
1955
1951
|
});
|
|
@@ -2354,8 +2350,8 @@ setFunctionName(WritableStreamDefaultWriter.prototype.abort, 'abort');
|
|
|
2354
2350
|
setFunctionName(WritableStreamDefaultWriter.prototype.close, 'close');
|
|
2355
2351
|
setFunctionName(WritableStreamDefaultWriter.prototype.releaseLock, 'releaseLock');
|
|
2356
2352
|
setFunctionName(WritableStreamDefaultWriter.prototype.write, 'write');
|
|
2357
|
-
if (typeof
|
|
2358
|
-
Object.defineProperty(WritableStreamDefaultWriter.prototype,
|
|
2353
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
2354
|
+
Object.defineProperty(WritableStreamDefaultWriter.prototype, Symbol.toStringTag, {
|
|
2359
2355
|
value: 'WritableStreamDefaultWriter',
|
|
2360
2356
|
configurable: true
|
|
2361
2357
|
});
|
|
@@ -2521,8 +2517,8 @@ Object.defineProperties(WritableStreamDefaultController.prototype, {
|
|
|
2521
2517
|
signal: { enumerable: true },
|
|
2522
2518
|
error: { enumerable: true }
|
|
2523
2519
|
});
|
|
2524
|
-
if (typeof
|
|
2525
|
-
Object.defineProperty(WritableStreamDefaultController.prototype,
|
|
2520
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
2521
|
+
Object.defineProperty(WritableStreamDefaultController.prototype, Symbol.toStringTag, {
|
|
2526
2522
|
value: 'WritableStreamDefaultController',
|
|
2527
2523
|
configurable: true
|
|
2528
2524
|
});
|
|
@@ -3136,8 +3132,8 @@ Object.defineProperties(ReadableStreamDefaultController.prototype, {
|
|
|
3136
3132
|
setFunctionName(ReadableStreamDefaultController.prototype.close, 'close');
|
|
3137
3133
|
setFunctionName(ReadableStreamDefaultController.prototype.enqueue, 'enqueue');
|
|
3138
3134
|
setFunctionName(ReadableStreamDefaultController.prototype.error, 'error');
|
|
3139
|
-
if (typeof
|
|
3140
|
-
Object.defineProperty(ReadableStreamDefaultController.prototype,
|
|
3135
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
3136
|
+
Object.defineProperty(ReadableStreamDefaultController.prototype, Symbol.toStringTag, {
|
|
3141
3137
|
value: 'ReadableStreamDefaultController',
|
|
3142
3138
|
configurable: true
|
|
3143
3139
|
});
|
|
@@ -3972,6 +3968,10 @@ class ReadableStream {
|
|
|
3972
3968
|
const options = convertIteratorOptions(rawOptions, 'First parameter');
|
|
3973
3969
|
return AcquireReadableStreamAsyncIterator(this, options.preventCancel);
|
|
3974
3970
|
}
|
|
3971
|
+
[SymbolAsyncIterator](options) {
|
|
3972
|
+
// Stub implementation, overridden below
|
|
3973
|
+
return this.values(options);
|
|
3974
|
+
}
|
|
3975
3975
|
/**
|
|
3976
3976
|
* Creates a new ReadableStream wrapping the provided iterable or async iterable.
|
|
3977
3977
|
*
|
|
@@ -4001,19 +4001,17 @@ setFunctionName(ReadableStream.prototype.pipeThrough, 'pipeThrough');
|
|
|
4001
4001
|
setFunctionName(ReadableStream.prototype.pipeTo, 'pipeTo');
|
|
4002
4002
|
setFunctionName(ReadableStream.prototype.tee, 'tee');
|
|
4003
4003
|
setFunctionName(ReadableStream.prototype.values, 'values');
|
|
4004
|
-
if (typeof
|
|
4005
|
-
Object.defineProperty(ReadableStream.prototype,
|
|
4004
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
4005
|
+
Object.defineProperty(ReadableStream.prototype, Symbol.toStringTag, {
|
|
4006
4006
|
value: 'ReadableStream',
|
|
4007
4007
|
configurable: true
|
|
4008
4008
|
});
|
|
4009
4009
|
}
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
});
|
|
4016
|
-
}
|
|
4010
|
+
Object.defineProperty(ReadableStream.prototype, SymbolAsyncIterator, {
|
|
4011
|
+
value: ReadableStream.prototype.values,
|
|
4012
|
+
writable: true,
|
|
4013
|
+
configurable: true
|
|
4014
|
+
});
|
|
4017
4015
|
// Abstract operations for the ReadableStream.
|
|
4018
4016
|
// Throws if and only if startAlgorithm throws.
|
|
4019
4017
|
function CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark = 1, sizeAlgorithm = () => 1) {
|
|
@@ -4156,8 +4154,8 @@ Object.defineProperties(ByteLengthQueuingStrategy.prototype, {
|
|
|
4156
4154
|
highWaterMark: { enumerable: true },
|
|
4157
4155
|
size: { enumerable: true }
|
|
4158
4156
|
});
|
|
4159
|
-
if (typeof
|
|
4160
|
-
Object.defineProperty(ByteLengthQueuingStrategy.prototype,
|
|
4157
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
4158
|
+
Object.defineProperty(ByteLengthQueuingStrategy.prototype, Symbol.toStringTag, {
|
|
4161
4159
|
value: 'ByteLengthQueuingStrategy',
|
|
4162
4160
|
configurable: true
|
|
4163
4161
|
});
|
|
@@ -4216,8 +4214,8 @@ Object.defineProperties(CountQueuingStrategy.prototype, {
|
|
|
4216
4214
|
highWaterMark: { enumerable: true },
|
|
4217
4215
|
size: { enumerable: true }
|
|
4218
4216
|
});
|
|
4219
|
-
if (typeof
|
|
4220
|
-
Object.defineProperty(CountQueuingStrategy.prototype,
|
|
4217
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
4218
|
+
Object.defineProperty(CountQueuingStrategy.prototype, Symbol.toStringTag, {
|
|
4221
4219
|
value: 'CountQueuingStrategy',
|
|
4222
4220
|
configurable: true
|
|
4223
4221
|
});
|
|
@@ -4341,8 +4339,8 @@ Object.defineProperties(TransformStream.prototype, {
|
|
|
4341
4339
|
readable: { enumerable: true },
|
|
4342
4340
|
writable: { enumerable: true }
|
|
4343
4341
|
});
|
|
4344
|
-
if (typeof
|
|
4345
|
-
Object.defineProperty(TransformStream.prototype,
|
|
4342
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
4343
|
+
Object.defineProperty(TransformStream.prototype, Symbol.toStringTag, {
|
|
4346
4344
|
value: 'TransformStream',
|
|
4347
4345
|
configurable: true
|
|
4348
4346
|
});
|
|
@@ -4468,8 +4466,8 @@ Object.defineProperties(TransformStreamDefaultController.prototype, {
|
|
|
4468
4466
|
setFunctionName(TransformStreamDefaultController.prototype.enqueue, 'enqueue');
|
|
4469
4467
|
setFunctionName(TransformStreamDefaultController.prototype.error, 'error');
|
|
4470
4468
|
setFunctionName(TransformStreamDefaultController.prototype.terminate, 'terminate');
|
|
4471
|
-
if (typeof
|
|
4472
|
-
Object.defineProperty(TransformStreamDefaultController.prototype,
|
|
4469
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
4470
|
+
Object.defineProperty(TransformStreamDefaultController.prototype, Symbol.toStringTag, {
|
|
4473
4471
|
value: 'TransformStreamDefaultController',
|
|
4474
4472
|
configurable: true
|
|
4475
4473
|
});
|