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/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ import { ReadableStream } from "web-streams-polyfill/ponyfill";
|
|
|
51
51
|
const readable = new ReadableStream();
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
## Compatibility
|
|
55
55
|
|
|
56
56
|
The `polyfill` and `ponyfill` variants work in any ES5-compatible environment that has a global `Promise`.
|
|
57
57
|
If you need to support older browsers or Node versions that do not have a native `Promise` implementation
|
|
@@ -66,15 +66,15 @@ The `polyfill/es2018` and `ponyfill/es2018` variants work in any ES2018-compatib
|
|
|
66
66
|
|
|
67
67
|
[`WritableStreamDefaultController.signal`][ws-controller-signal] is available in all variants, but requires a global `AbortController` constructor. If necessary, consider using a polyfill such as [abortcontroller-polyfill].
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
[Reading with a BYOB reader][mdn-byob-read] is available in all variants, but requires `ArrayBuffer.prototype.transfer()` or `structuredClone()` to exist in order to correctly transfer the given view's buffer. If not available, then the buffer won't be transferred during the read.
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
## Compliance
|
|
72
|
+
|
|
73
|
+
The polyfill implements [version `4dc123a` (13 Nov 2023)][spec-snapshot] of the streams specification.
|
|
72
74
|
|
|
73
75
|
The polyfill is tested against the same [web platform tests][wpt] that are used by browsers to test their native implementations.
|
|
74
76
|
The polyfill aims to pass all tests, although it allows some exceptions for practical reasons:
|
|
75
|
-
* The `es2018` variant passes all of the tests
|
|
76
|
-
These tests require the implementation to synchronously transfer the contents of an `ArrayBuffer`, which is not yet possible from JavaScript (although there is a [proposal][proposal-arraybuffer-transfer] to make it possible).
|
|
77
|
-
The reference implementation "cheats" on these tests [by making a copy instead][ref-impl-transferarraybuffer], but that is unacceptable for the polyfill's performance ([#3][issue-3]).
|
|
77
|
+
* The `es2018` variant passes all of the tests.
|
|
78
78
|
* The `es6` variant passes the same tests as the `es2018` variant, except for the [test for the prototype of `ReadableStream`'s async iterator][wpt-async-iterator-prototype].
|
|
79
79
|
Retrieving the correct `%AsyncIteratorPrototype%` requires using an async generator (`async function* () {}`), which is invalid syntax before ES2018.
|
|
80
80
|
Instead, the polyfill [creates its own version][stub-async-iterator-prototype] which is functionally equivalent to the real prototype.
|
|
@@ -88,7 +88,7 @@ The polyfill aims to pass all tests, although it allows some exceptions for prac
|
|
|
88
88
|
|
|
89
89
|
The type definitions are compatible with the built-in stream types of TypeScript 3.3.
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
## Contributors
|
|
92
92
|
|
|
93
93
|
Thanks to these people for their work on [the original polyfill][creatorrr-polyfill]:
|
|
94
94
|
|
|
@@ -103,12 +103,9 @@ Thanks to these people for their work on [the original polyfill][creatorrr-polyf
|
|
|
103
103
|
[rs-asynciterator]: https://streams.spec.whatwg.org/#rs-asynciterator
|
|
104
104
|
[ws-controller-signal]: https://streams.spec.whatwg.org/#ws-default-controller-signal
|
|
105
105
|
[abortcontroller-polyfill]: https://www.npmjs.com/package/abortcontroller-polyfill
|
|
106
|
-
[
|
|
107
|
-
[
|
|
108
|
-
[wpt
|
|
109
|
-
[
|
|
110
|
-
[ref-impl-transferarraybuffer]: https://github.com/whatwg/streams/blob/4b6b93c69e531e2fe45a6ed4cb1484a7ba4eb8bb/reference-implementation/lib/abstract-ops/ecmascript.js#L16
|
|
111
|
-
[issue-3]: https://github.com/MattiasBuelens/web-streams-polyfill/issues/3
|
|
112
|
-
[wpt-async-iterator-prototype]: https://github.com/web-platform-tests/wpt/blob/96ca25f0f7526282c0d47e6bf6a7edd439da1968/streams/readable-streams/async-iterator.any.js#L24
|
|
106
|
+
[mdn-byob-read]: https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/read
|
|
107
|
+
[spec-snapshot]: https://streams.spec.whatwg.org/commit-snapshots/4dc123a6e7f7ba89a8c6a7975b021156f39cab52/
|
|
108
|
+
[wpt]: https://github.com/web-platform-tests/wpt/tree/2a298b616b7c865917d7198a287310881cbfdd8d/streams
|
|
109
|
+
[wpt-async-iterator-prototype]: https://github.com/web-platform-tests/wpt/blob/2a298b616b7c865917d7198a287310881cbfdd8d/streams/readable-streams/async-iterator.any.js#L24
|
|
113
110
|
[stub-async-iterator-prototype]: https://github.com/MattiasBuelens/web-streams-polyfill/blob/v2.0.0/src/target/es5/stub/async-iterator-prototype.ts
|
|
114
111
|
[creatorrr-polyfill]: https://github.com/creatorrr/web-streams-polyfill
|