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/ponyfill.es2018.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
@@ -11,11 +11,6 @@
|
|
|
11
11
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.WebStreamsPolyfill = {}));
|
|
12
12
|
})(this, (function (exports) { 'use strict';
|
|
13
13
|
|
|
14
|
-
/// <reference lib="es2015.symbol" />
|
|
15
|
-
const SymbolPolyfill = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?
|
|
16
|
-
Symbol :
|
|
17
|
-
description => `Symbol(${description})`;
|
|
18
|
-
|
|
19
14
|
function noop() {
|
|
20
15
|
return undefined;
|
|
21
16
|
}
|
|
@@ -208,11 +203,11 @@
|
|
|
208
203
|
}
|
|
209
204
|
}
|
|
210
205
|
|
|
211
|
-
const AbortSteps =
|
|
212
|
-
const ErrorSteps =
|
|
213
|
-
const CancelSteps =
|
|
214
|
-
const PullSteps =
|
|
215
|
-
const ReleaseSteps =
|
|
206
|
+
const AbortSteps = Symbol('[[AbortSteps]]');
|
|
207
|
+
const ErrorSteps = Symbol('[[ErrorSteps]]');
|
|
208
|
+
const CancelSteps = Symbol('[[CancelSteps]]');
|
|
209
|
+
const PullSteps = Symbol('[[PullSteps]]');
|
|
210
|
+
const ReleaseSteps = Symbol('[[ReleaseSteps]]');
|
|
216
211
|
|
|
217
212
|
function ReadableStreamReaderGenericInitialize(reader, stream) {
|
|
218
213
|
reader._ownerReadableStream = stream;
|
|
@@ -492,8 +487,8 @@
|
|
|
492
487
|
setFunctionName(ReadableStreamDefaultReader.prototype.cancel, 'cancel');
|
|
493
488
|
setFunctionName(ReadableStreamDefaultReader.prototype.read, 'read');
|
|
494
489
|
setFunctionName(ReadableStreamDefaultReader.prototype.releaseLock, 'releaseLock');
|
|
495
|
-
if (typeof
|
|
496
|
-
Object.defineProperty(ReadableStreamDefaultReader.prototype,
|
|
490
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
491
|
+
Object.defineProperty(ReadableStreamDefaultReader.prototype, Symbol.toStringTag, {
|
|
497
492
|
value: 'ReadableStreamDefaultReader',
|
|
498
493
|
configurable: true
|
|
499
494
|
});
|
|
@@ -626,9 +621,7 @@
|
|
|
626
621
|
return this._asyncIteratorImpl.return(value);
|
|
627
622
|
}
|
|
628
623
|
};
|
|
629
|
-
|
|
630
|
-
Object.setPrototypeOf(ReadableStreamAsyncIteratorPrototype, AsyncIteratorPrototype);
|
|
631
|
-
}
|
|
624
|
+
Object.setPrototypeOf(ReadableStreamAsyncIteratorPrototype, AsyncIteratorPrototype);
|
|
632
625
|
// Abstract operations for the ReadableStream.
|
|
633
626
|
function AcquireReadableStreamAsyncIterator(stream, preventCancel) {
|
|
634
627
|
const reader = AcquireReadableStreamDefaultReader(stream);
|
|
@@ -665,6 +658,7 @@
|
|
|
665
658
|
return x !== x;
|
|
666
659
|
};
|
|
667
660
|
|
|
661
|
+
var _a, _b, _c;
|
|
668
662
|
function CreateArrayFromList(elements) {
|
|
669
663
|
// We use arrays to represent lists, so this is basically a no-op.
|
|
670
664
|
// Do a slice though just in case we happen to depend on the unique-ness.
|
|
@@ -722,7 +716,7 @@
|
|
|
722
716
|
// we use yield* inside an async generator function to achieve the same result.
|
|
723
717
|
// Wrap the sync iterator inside a sync iterable, so we can use it with yield*.
|
|
724
718
|
const syncIterable = {
|
|
725
|
-
[
|
|
719
|
+
[Symbol.iterator]: () => syncIteratorRecord.iterator
|
|
726
720
|
};
|
|
727
721
|
// Create an async generator function and immediately invoke it.
|
|
728
722
|
const asyncIterator = (async function* () {
|
|
@@ -732,18 +726,20 @@
|
|
|
732
726
|
const nextMethod = asyncIterator.next;
|
|
733
727
|
return { iterator: asyncIterator, nextMethod, done: false };
|
|
734
728
|
}
|
|
729
|
+
// Aligns with core-js/modules/es.symbol.async-iterator.js
|
|
730
|
+
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';
|
|
735
731
|
function GetIterator(obj, hint = 'sync', method) {
|
|
736
732
|
if (method === undefined) {
|
|
737
733
|
if (hint === 'async') {
|
|
738
|
-
method = GetMethod(obj,
|
|
734
|
+
method = GetMethod(obj, SymbolAsyncIterator);
|
|
739
735
|
if (method === undefined) {
|
|
740
|
-
const syncMethod = GetMethod(obj,
|
|
736
|
+
const syncMethod = GetMethod(obj, Symbol.iterator);
|
|
741
737
|
const syncIteratorRecord = GetIterator(obj, 'sync', syncMethod);
|
|
742
738
|
return CreateAsyncFromSyncIterator(syncIteratorRecord);
|
|
743
739
|
}
|
|
744
740
|
}
|
|
745
741
|
else {
|
|
746
|
-
method = GetMethod(obj,
|
|
742
|
+
method = GetMethod(obj, Symbol.iterator);
|
|
747
743
|
}
|
|
748
744
|
}
|
|
749
745
|
if (method === undefined) {
|
|
@@ -880,8 +876,8 @@
|
|
|
880
876
|
});
|
|
881
877
|
setFunctionName(ReadableStreamBYOBRequest.prototype.respond, 'respond');
|
|
882
878
|
setFunctionName(ReadableStreamBYOBRequest.prototype.respondWithNewView, 'respondWithNewView');
|
|
883
|
-
if (typeof
|
|
884
|
-
Object.defineProperty(ReadableStreamBYOBRequest.prototype,
|
|
879
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
880
|
+
Object.defineProperty(ReadableStreamBYOBRequest.prototype, Symbol.toStringTag, {
|
|
885
881
|
value: 'ReadableStreamBYOBRequest',
|
|
886
882
|
configurable: true
|
|
887
883
|
});
|
|
@@ -1024,8 +1020,8 @@
|
|
|
1024
1020
|
setFunctionName(ReadableByteStreamController.prototype.close, 'close');
|
|
1025
1021
|
setFunctionName(ReadableByteStreamController.prototype.enqueue, 'enqueue');
|
|
1026
1022
|
setFunctionName(ReadableByteStreamController.prototype.error, 'error');
|
|
1027
|
-
if (typeof
|
|
1028
|
-
Object.defineProperty(ReadableByteStreamController.prototype,
|
|
1023
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
1024
|
+
Object.defineProperty(ReadableByteStreamController.prototype, Symbol.toStringTag, {
|
|
1029
1025
|
value: 'ReadableByteStreamController',
|
|
1030
1026
|
configurable: true
|
|
1031
1027
|
});
|
|
@@ -1713,8 +1709,8 @@
|
|
|
1713
1709
|
setFunctionName(ReadableStreamBYOBReader.prototype.cancel, 'cancel');
|
|
1714
1710
|
setFunctionName(ReadableStreamBYOBReader.prototype.read, 'read');
|
|
1715
1711
|
setFunctionName(ReadableStreamBYOBReader.prototype.releaseLock, 'releaseLock');
|
|
1716
|
-
if (typeof
|
|
1717
|
-
Object.defineProperty(ReadableStreamBYOBReader.prototype,
|
|
1712
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
1713
|
+
Object.defineProperty(ReadableStreamBYOBReader.prototype, Symbol.toStringTag, {
|
|
1718
1714
|
value: 'ReadableStreamBYOBReader',
|
|
1719
1715
|
configurable: true
|
|
1720
1716
|
});
|
|
@@ -1954,8 +1950,8 @@
|
|
|
1954
1950
|
setFunctionName(WritableStream.prototype.abort, 'abort');
|
|
1955
1951
|
setFunctionName(WritableStream.prototype.close, 'close');
|
|
1956
1952
|
setFunctionName(WritableStream.prototype.getWriter, 'getWriter');
|
|
1957
|
-
if (typeof
|
|
1958
|
-
Object.defineProperty(WritableStream.prototype,
|
|
1953
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
1954
|
+
Object.defineProperty(WritableStream.prototype, Symbol.toStringTag, {
|
|
1959
1955
|
value: 'WritableStream',
|
|
1960
1956
|
configurable: true
|
|
1961
1957
|
});
|
|
@@ -2360,8 +2356,8 @@
|
|
|
2360
2356
|
setFunctionName(WritableStreamDefaultWriter.prototype.close, 'close');
|
|
2361
2357
|
setFunctionName(WritableStreamDefaultWriter.prototype.releaseLock, 'releaseLock');
|
|
2362
2358
|
setFunctionName(WritableStreamDefaultWriter.prototype.write, 'write');
|
|
2363
|
-
if (typeof
|
|
2364
|
-
Object.defineProperty(WritableStreamDefaultWriter.prototype,
|
|
2359
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
2360
|
+
Object.defineProperty(WritableStreamDefaultWriter.prototype, Symbol.toStringTag, {
|
|
2365
2361
|
value: 'WritableStreamDefaultWriter',
|
|
2366
2362
|
configurable: true
|
|
2367
2363
|
});
|
|
@@ -2527,8 +2523,8 @@
|
|
|
2527
2523
|
signal: { enumerable: true },
|
|
2528
2524
|
error: { enumerable: true }
|
|
2529
2525
|
});
|
|
2530
|
-
if (typeof
|
|
2531
|
-
Object.defineProperty(WritableStreamDefaultController.prototype,
|
|
2526
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
2527
|
+
Object.defineProperty(WritableStreamDefaultController.prototype, Symbol.toStringTag, {
|
|
2532
2528
|
value: 'WritableStreamDefaultController',
|
|
2533
2529
|
configurable: true
|
|
2534
2530
|
});
|
|
@@ -3142,8 +3138,8 @@
|
|
|
3142
3138
|
setFunctionName(ReadableStreamDefaultController.prototype.close, 'close');
|
|
3143
3139
|
setFunctionName(ReadableStreamDefaultController.prototype.enqueue, 'enqueue');
|
|
3144
3140
|
setFunctionName(ReadableStreamDefaultController.prototype.error, 'error');
|
|
3145
|
-
if (typeof
|
|
3146
|
-
Object.defineProperty(ReadableStreamDefaultController.prototype,
|
|
3141
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
3142
|
+
Object.defineProperty(ReadableStreamDefaultController.prototype, Symbol.toStringTag, {
|
|
3147
3143
|
value: 'ReadableStreamDefaultController',
|
|
3148
3144
|
configurable: true
|
|
3149
3145
|
});
|
|
@@ -3978,6 +3974,10 @@
|
|
|
3978
3974
|
const options = convertIteratorOptions(rawOptions, 'First parameter');
|
|
3979
3975
|
return AcquireReadableStreamAsyncIterator(this, options.preventCancel);
|
|
3980
3976
|
}
|
|
3977
|
+
[SymbolAsyncIterator](options) {
|
|
3978
|
+
// Stub implementation, overridden below
|
|
3979
|
+
return this.values(options);
|
|
3980
|
+
}
|
|
3981
3981
|
/**
|
|
3982
3982
|
* Creates a new ReadableStream wrapping the provided iterable or async iterable.
|
|
3983
3983
|
*
|
|
@@ -4007,19 +4007,17 @@
|
|
|
4007
4007
|
setFunctionName(ReadableStream.prototype.pipeTo, 'pipeTo');
|
|
4008
4008
|
setFunctionName(ReadableStream.prototype.tee, 'tee');
|
|
4009
4009
|
setFunctionName(ReadableStream.prototype.values, 'values');
|
|
4010
|
-
if (typeof
|
|
4011
|
-
Object.defineProperty(ReadableStream.prototype,
|
|
4010
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
4011
|
+
Object.defineProperty(ReadableStream.prototype, Symbol.toStringTag, {
|
|
4012
4012
|
value: 'ReadableStream',
|
|
4013
4013
|
configurable: true
|
|
4014
4014
|
});
|
|
4015
4015
|
}
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
});
|
|
4022
|
-
}
|
|
4016
|
+
Object.defineProperty(ReadableStream.prototype, SymbolAsyncIterator, {
|
|
4017
|
+
value: ReadableStream.prototype.values,
|
|
4018
|
+
writable: true,
|
|
4019
|
+
configurable: true
|
|
4020
|
+
});
|
|
4023
4021
|
// Abstract operations for the ReadableStream.
|
|
4024
4022
|
// Throws if and only if startAlgorithm throws.
|
|
4025
4023
|
function CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark = 1, sizeAlgorithm = () => 1) {
|
|
@@ -4162,8 +4160,8 @@
|
|
|
4162
4160
|
highWaterMark: { enumerable: true },
|
|
4163
4161
|
size: { enumerable: true }
|
|
4164
4162
|
});
|
|
4165
|
-
if (typeof
|
|
4166
|
-
Object.defineProperty(ByteLengthQueuingStrategy.prototype,
|
|
4163
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
4164
|
+
Object.defineProperty(ByteLengthQueuingStrategy.prototype, Symbol.toStringTag, {
|
|
4167
4165
|
value: 'ByteLengthQueuingStrategy',
|
|
4168
4166
|
configurable: true
|
|
4169
4167
|
});
|
|
@@ -4222,8 +4220,8 @@
|
|
|
4222
4220
|
highWaterMark: { enumerable: true },
|
|
4223
4221
|
size: { enumerable: true }
|
|
4224
4222
|
});
|
|
4225
|
-
if (typeof
|
|
4226
|
-
Object.defineProperty(CountQueuingStrategy.prototype,
|
|
4223
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
4224
|
+
Object.defineProperty(CountQueuingStrategy.prototype, Symbol.toStringTag, {
|
|
4227
4225
|
value: 'CountQueuingStrategy',
|
|
4228
4226
|
configurable: true
|
|
4229
4227
|
});
|
|
@@ -4347,8 +4345,8 @@
|
|
|
4347
4345
|
readable: { enumerable: true },
|
|
4348
4346
|
writable: { enumerable: true }
|
|
4349
4347
|
});
|
|
4350
|
-
if (typeof
|
|
4351
|
-
Object.defineProperty(TransformStream.prototype,
|
|
4348
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
4349
|
+
Object.defineProperty(TransformStream.prototype, Symbol.toStringTag, {
|
|
4352
4350
|
value: 'TransformStream',
|
|
4353
4351
|
configurable: true
|
|
4354
4352
|
});
|
|
@@ -4474,8 +4472,8 @@
|
|
|
4474
4472
|
setFunctionName(TransformStreamDefaultController.prototype.enqueue, 'enqueue');
|
|
4475
4473
|
setFunctionName(TransformStreamDefaultController.prototype.error, 'error');
|
|
4476
4474
|
setFunctionName(TransformStreamDefaultController.prototype.terminate, 'terminate');
|
|
4477
|
-
if (typeof
|
|
4478
|
-
Object.defineProperty(TransformStreamDefaultController.prototype,
|
|
4475
|
+
if (typeof Symbol.toStringTag === 'symbol') {
|
|
4476
|
+
Object.defineProperty(TransformStreamDefaultController.prototype, Symbol.toStringTag, {
|
|
4479
4477
|
value: 'TransformStreamDefaultController',
|
|
4480
4478
|
configurable: true
|
|
4481
4479
|
});
|