web-streams-polyfill 3.2.1 → 3.3.0
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/LICENSE +1 -1
- package/README.md +11 -14
- package/dist/polyfill.es2018.js +723 -197
- package/dist/polyfill.es2018.js.map +1 -1
- package/dist/polyfill.es2018.min.js +8 -1
- package/dist/polyfill.es2018.min.js.map +1 -1
- package/dist/polyfill.es2018.mjs +721 -193
- package/dist/polyfill.es2018.mjs.map +1 -1
- package/dist/polyfill.es6.js +789 -197
- package/dist/polyfill.es6.js.map +1 -1
- package/dist/polyfill.es6.min.js +8 -1
- package/dist/polyfill.es6.min.js.map +1 -1
- package/dist/polyfill.es6.mjs +787 -193
- package/dist/polyfill.es6.mjs.map +1 -1
- package/dist/polyfill.js +873 -243
- package/dist/polyfill.js.map +1 -1
- package/dist/polyfill.min.js +8 -1
- package/dist/polyfill.min.js.map +1 -1
- package/dist/polyfill.mjs +871 -239
- package/dist/polyfill.mjs.map +1 -1
- package/dist/ponyfill.es2018.js +723 -197
- package/dist/ponyfill.es2018.js.map +1 -1
- package/dist/ponyfill.es2018.mjs +721 -193
- package/dist/ponyfill.es2018.mjs.map +1 -1
- package/dist/ponyfill.es6.js +789 -197
- package/dist/ponyfill.es6.js.map +1 -1
- package/dist/ponyfill.es6.mjs +787 -193
- package/dist/ponyfill.es6.mjs.map +1 -1
- package/dist/ponyfill.js +873 -243
- package/dist/ponyfill.js.map +1 -1
- package/dist/ponyfill.mjs +871 -239
- package/dist/ponyfill.mjs.map +1 -1
- package/es2018/package.json +1 -1
- package/es6/package.json +1 -1
- package/package.json +30 -32
- package/ponyfill/es2018/package.json +1 -1
- package/ponyfill/es6/package.json +1 -1
- package/ponyfill/package.json +1 -1
- package/types/polyfill.d.ts +29 -0
- package/{dist/types/ts3.6/polyfill.d.ts → types/ponyfill.d.ts} +57 -7
- package/{dist/types → types}/tsdoc-metadata.json +1 -1
- package/dist/types/polyfill.d.ts +0 -771
package/es2018/package.json
CHANGED
package/es6/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,39 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-streams-polyfill",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Web Streams, based on the WHATWG spec reference implementation",
|
|
5
5
|
"main": "dist/polyfill",
|
|
6
6
|
"browser": "dist/polyfill.min.js",
|
|
7
7
|
"module": "dist/polyfill.mjs",
|
|
8
|
-
"types": "
|
|
9
|
-
"typesVersions": {
|
|
10
|
-
">=3.6": {
|
|
11
|
-
"dist/types/*": [
|
|
12
|
-
"dist/types/ts3.6/*"
|
|
13
|
-
]
|
|
14
|
-
}
|
|
15
|
-
},
|
|
8
|
+
"types": "types/polyfill.d.ts",
|
|
16
9
|
"scripts": {
|
|
17
10
|
"test": "npm run test:types && npm run test:unit && npm run test:wpt",
|
|
18
|
-
"test:wpt": "node
|
|
19
|
-
"
|
|
11
|
+
"test:wpt": "npm run test:wpt:node && npm run test:wpt:chromium && npm run test:wpt:firefox",
|
|
12
|
+
"test:wpt:node": "node --expose_gc ./test/wpt/node/run.js",
|
|
13
|
+
"test:wpt:chromium": "node ./test/wpt/browser/run.js --browser chromium",
|
|
14
|
+
"test:wpt:firefox": "node ./test/wpt/browser/run.js --browser firefox",
|
|
20
15
|
"test:types": "tsc -p ./test/types/tsconfig.json",
|
|
21
16
|
"test:unit": "jasmine --config=test/unit/jasmine.json",
|
|
22
17
|
"lint": "eslint \"src/**/*.ts\"",
|
|
23
18
|
"build": "npm run build:bundle && npm run build:types",
|
|
24
19
|
"build:bundle": "rollup -c",
|
|
25
|
-
"build:types": "tsc --project . --emitDeclarationOnly --declarationDir ./lib && api-extractor run
|
|
26
|
-
"accept:types": "tsc --project . --emitDeclarationOnly --declarationDir ./lib && api-extractor run --local
|
|
20
|
+
"build:types": "tsc --project . --emitDeclarationOnly --declarationDir ./lib && api-extractor run",
|
|
21
|
+
"accept:types": "tsc --project . --emitDeclarationOnly --declarationDir ./lib && api-extractor run --local",
|
|
27
22
|
"prepare": "npm run build"
|
|
28
23
|
},
|
|
29
24
|
"files": [
|
|
30
25
|
"dist",
|
|
31
26
|
"es6",
|
|
32
27
|
"es2018",
|
|
33
|
-
"ponyfill"
|
|
28
|
+
"ponyfill",
|
|
29
|
+
"types"
|
|
34
30
|
],
|
|
35
31
|
"engines": {
|
|
36
|
-
"node": ">=
|
|
32
|
+
"node": ">= 18"
|
|
37
33
|
},
|
|
38
34
|
"repository": {
|
|
39
35
|
"type": "git",
|
|
@@ -54,23 +50,25 @@
|
|
|
54
50
|
},
|
|
55
51
|
"homepage": "https://github.com/MattiasBuelens/web-streams-polyfill#readme",
|
|
56
52
|
"devDependencies": {
|
|
57
|
-
"@microsoft/api-extractor": "^7.
|
|
58
|
-
"@rollup/plugin-inject": "^
|
|
59
|
-
"@rollup/plugin-replace": "^
|
|
60
|
-
"@rollup/plugin-strip": "^
|
|
61
|
-
"@rollup/plugin-typescript": "^
|
|
62
|
-
"@
|
|
63
|
-
"@
|
|
64
|
-
"@typescript-eslint/
|
|
53
|
+
"@microsoft/api-extractor": "^7.39.1",
|
|
54
|
+
"@rollup/plugin-inject": "^5.0.5",
|
|
55
|
+
"@rollup/plugin-replace": "^5.0.5",
|
|
56
|
+
"@rollup/plugin-strip": "^3.0.4",
|
|
57
|
+
"@rollup/plugin-typescript": "^11.1.5",
|
|
58
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
59
|
+
"@types/node": "^18.19.4",
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^6.17.0",
|
|
61
|
+
"@typescript-eslint/parser": "^6.17.0",
|
|
65
62
|
"@ungap/promise-all-settled": "^1.1.2",
|
|
66
|
-
"eslint": "^
|
|
67
|
-
"jasmine": "^
|
|
68
|
-
"micromatch": "^4.0.
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
63
|
+
"eslint": "^8.56.0",
|
|
64
|
+
"jasmine": "^5.1.0",
|
|
65
|
+
"micromatch": "^4.0.5",
|
|
66
|
+
"minimist": "^1.2.5",
|
|
67
|
+
"playwright": "^1.14.1",
|
|
68
|
+
"recursive-readdir": "^2.2.2",
|
|
69
|
+
"rollup": "^4.9.2",
|
|
70
|
+
"tslib": "^2.6.2",
|
|
71
|
+
"typescript": "^5.3.3",
|
|
72
|
+
"wpt-runner": "^5.0.0"
|
|
75
73
|
}
|
|
76
74
|
}
|
package/ponyfill/package.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference lib="dom" />
|
|
2
|
+
/// <reference lib="es2018.asynciterable" />
|
|
3
|
+
|
|
4
|
+
import type { ReadableStreamAsyncIterator, ReadableStreamIteratorOptions } from './ponyfill';
|
|
5
|
+
|
|
6
|
+
export * from './ponyfill';
|
|
7
|
+
|
|
8
|
+
declare global {
|
|
9
|
+
interface ReadableStream<R = any> {
|
|
10
|
+
/**
|
|
11
|
+
* Asynchronously iterates over the chunks in the stream's internal queue.
|
|
12
|
+
*
|
|
13
|
+
* Asynchronously iterating over the stream will lock it, preventing any other consumer from acquiring a reader.
|
|
14
|
+
* The lock will be released if the async iterator's {@link ReadableStreamAsyncIterator.return | return()} method
|
|
15
|
+
* is called, e.g. by breaking out of the loop.
|
|
16
|
+
*
|
|
17
|
+
* By default, calling the async iterator's {@link ReadableStreamAsyncIterator.return | return()} method will also
|
|
18
|
+
* cancel the stream. To prevent this, use the stream's {@link ReadableStream.values | values()} method, passing
|
|
19
|
+
* `true` for the `preventCancel` option.
|
|
20
|
+
*/
|
|
21
|
+
values(options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator<R>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* {@inheritDoc ReadableStream.values}
|
|
25
|
+
*/
|
|
26
|
+
[Symbol.asyncIterator]: (options?: ReadableStreamIteratorOptions) => ReadableStreamAsyncIterator<R>;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
@@ -16,6 +16,10 @@ export declare interface AbortSignal {
|
|
|
16
16
|
* Whether the request is aborted.
|
|
17
17
|
*/
|
|
18
18
|
readonly aborted: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* If aborted, returns the reason for aborting.
|
|
21
|
+
*/
|
|
22
|
+
readonly reason?: any;
|
|
19
23
|
/**
|
|
20
24
|
* Add an event listener to be triggered when this signal becomes aborted.
|
|
21
25
|
*/
|
|
@@ -87,11 +91,11 @@ export declare interface QueuingStrategyInit {
|
|
|
87
91
|
highWaterMark: number;
|
|
88
92
|
}
|
|
89
93
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
/**
|
|
95
|
+
* {@inheritDoc QueuingStrategy.size}
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
export declare type QueuingStrategySizeCallback<T = any> = (chunk: T) => number;
|
|
95
99
|
|
|
96
100
|
/**
|
|
97
101
|
* Allows control of a {@link ReadableStream | readable byte stream}'s state and internal queue.
|
|
@@ -215,6 +219,13 @@ export declare class ReadableStream<R = any> {
|
|
|
215
219
|
* {@inheritDoc ReadableStream.values}
|
|
216
220
|
*/
|
|
217
221
|
[Symbol.asyncIterator]: (options?: ReadableStreamIteratorOptions) => ReadableStreamAsyncIterator<R>;
|
|
222
|
+
/**
|
|
223
|
+
* Creates a new ReadableStream wrapping the provided iterable or async iterable.
|
|
224
|
+
*
|
|
225
|
+
* This can be used to adapt various kinds of objects into a readable stream,
|
|
226
|
+
* such as an array, an async generator, or a Node.js readable stream.
|
|
227
|
+
*/
|
|
228
|
+
static from<R>(asyncIterable: Iterable<R> | AsyncIterable<R> | ReadableStreamLike<R>): ReadableStream<R>;
|
|
218
229
|
}
|
|
219
230
|
|
|
220
231
|
/**
|
|
@@ -233,7 +244,7 @@ export declare interface ReadableStreamAsyncIterator<R> extends AsyncIterator<R>
|
|
|
233
244
|
* @public
|
|
234
245
|
*/
|
|
235
246
|
export declare class ReadableStreamBYOBReader {
|
|
236
|
-
constructor(stream:
|
|
247
|
+
constructor(stream: ReadableStream<Uint8Array>);
|
|
237
248
|
/**
|
|
238
249
|
* Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or
|
|
239
250
|
* the reader's lock is released before the stream finishes closing.
|
|
@@ -248,7 +259,7 @@ export declare class ReadableStreamBYOBReader {
|
|
|
248
259
|
*
|
|
249
260
|
* If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.
|
|
250
261
|
*/
|
|
251
|
-
read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamBYOBReadResult<T>>;
|
|
262
|
+
read<T extends ArrayBufferView>(view: T, options?: ReadableStreamBYOBReaderReadOptions): Promise<ReadableStreamBYOBReadResult<T>>;
|
|
252
263
|
/**
|
|
253
264
|
* Releases the reader's lock on the corresponding stream. After the lock is released, the reader is no longer active.
|
|
254
265
|
* If the associated stream is errored when the lock is released, the reader will appear errored in the same way
|
|
@@ -261,6 +272,16 @@ export declare class ReadableStreamBYOBReader {
|
|
|
261
272
|
releaseLock(): void;
|
|
262
273
|
}
|
|
263
274
|
|
|
275
|
+
/**
|
|
276
|
+
* Options for {@link ReadableStreamBYOBReader.read | reading} a stream
|
|
277
|
+
* with a {@link ReadableStreamBYOBReader | BYOB reader}.
|
|
278
|
+
*
|
|
279
|
+
* @public
|
|
280
|
+
*/
|
|
281
|
+
export declare interface ReadableStreamBYOBReaderReadOptions {
|
|
282
|
+
min?: number;
|
|
283
|
+
}
|
|
284
|
+
|
|
264
285
|
/**
|
|
265
286
|
* A result returned by {@link ReadableStreamBYOBReader.read}.
|
|
266
287
|
*
|
|
@@ -364,6 +385,18 @@ export declare class ReadableStreamDefaultReader<R = any> {
|
|
|
364
385
|
releaseLock(): void;
|
|
365
386
|
}
|
|
366
387
|
|
|
388
|
+
/**
|
|
389
|
+
* A common interface for a `ReadableStreamDefaultReader` implementation.
|
|
390
|
+
*
|
|
391
|
+
* @public
|
|
392
|
+
*/
|
|
393
|
+
export declare interface ReadableStreamDefaultReaderLike<R = any> {
|
|
394
|
+
readonly closed: Promise<undefined>;
|
|
395
|
+
cancel(reason?: any): Promise<void>;
|
|
396
|
+
read(): Promise<ReadableStreamDefaultReadResult<R>>;
|
|
397
|
+
releaseLock(): void;
|
|
398
|
+
}
|
|
399
|
+
|
|
367
400
|
/**
|
|
368
401
|
* A result returned by {@link ReadableStreamDefaultReader.read}.
|
|
369
402
|
*
|
|
@@ -386,6 +419,16 @@ export declare interface ReadableStreamIteratorOptions {
|
|
|
386
419
|
preventCancel?: boolean;
|
|
387
420
|
}
|
|
388
421
|
|
|
422
|
+
/**
|
|
423
|
+
* A common interface for a `ReadadableStream` implementation.
|
|
424
|
+
*
|
|
425
|
+
* @public
|
|
426
|
+
*/
|
|
427
|
+
export declare interface ReadableStreamLike<R = any> {
|
|
428
|
+
readonly locked: boolean;
|
|
429
|
+
getReader(): ReadableStreamDefaultReaderLike<R>;
|
|
430
|
+
}
|
|
431
|
+
|
|
389
432
|
/**
|
|
390
433
|
* A pair of a {@link ReadableStream | readable stream} and {@link WritableStream | writable stream} that can be passed
|
|
391
434
|
* to {@link ReadableStream.pipeThrough}.
|
|
@@ -443,10 +486,17 @@ export declare interface Transformer<I = any, O = any> {
|
|
|
443
486
|
* through {@link Transformer.transform | transform()}, and the writable side is about to be closed.
|
|
444
487
|
*/
|
|
445
488
|
flush?: TransformerFlushCallback<O>;
|
|
489
|
+
/**
|
|
490
|
+
* A function called when the readable side is cancelled, or when the writable side is aborted.
|
|
491
|
+
*/
|
|
492
|
+
cancel?: TransformerCancelCallback;
|
|
446
493
|
readableType?: undefined;
|
|
447
494
|
writableType?: undefined;
|
|
448
495
|
}
|
|
449
496
|
|
|
497
|
+
/** @public */
|
|
498
|
+
export declare type TransformerCancelCallback = (reason: any) => void | PromiseLike<void>;
|
|
499
|
+
|
|
450
500
|
/** @public */
|
|
451
501
|
export declare type TransformerFlushCallback<O> = (controller: TransformStreamDefaultController<O>) => void | PromiseLike<void>;
|
|
452
502
|
|