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.
Files changed (42) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +11 -14
  3. package/dist/polyfill.es2018.js +723 -197
  4. package/dist/polyfill.es2018.js.map +1 -1
  5. package/dist/polyfill.es2018.min.js +8 -1
  6. package/dist/polyfill.es2018.min.js.map +1 -1
  7. package/dist/polyfill.es2018.mjs +721 -193
  8. package/dist/polyfill.es2018.mjs.map +1 -1
  9. package/dist/polyfill.es6.js +789 -197
  10. package/dist/polyfill.es6.js.map +1 -1
  11. package/dist/polyfill.es6.min.js +8 -1
  12. package/dist/polyfill.es6.min.js.map +1 -1
  13. package/dist/polyfill.es6.mjs +787 -193
  14. package/dist/polyfill.es6.mjs.map +1 -1
  15. package/dist/polyfill.js +873 -243
  16. package/dist/polyfill.js.map +1 -1
  17. package/dist/polyfill.min.js +8 -1
  18. package/dist/polyfill.min.js.map +1 -1
  19. package/dist/polyfill.mjs +871 -239
  20. package/dist/polyfill.mjs.map +1 -1
  21. package/dist/ponyfill.es2018.js +723 -197
  22. package/dist/ponyfill.es2018.js.map +1 -1
  23. package/dist/ponyfill.es2018.mjs +721 -193
  24. package/dist/ponyfill.es2018.mjs.map +1 -1
  25. package/dist/ponyfill.es6.js +789 -197
  26. package/dist/ponyfill.es6.js.map +1 -1
  27. package/dist/ponyfill.es6.mjs +787 -193
  28. package/dist/ponyfill.es6.mjs.map +1 -1
  29. package/dist/ponyfill.js +873 -243
  30. package/dist/ponyfill.js.map +1 -1
  31. package/dist/ponyfill.mjs +871 -239
  32. package/dist/ponyfill.mjs.map +1 -1
  33. package/es2018/package.json +1 -1
  34. package/es6/package.json +1 -1
  35. package/package.json +30 -32
  36. package/ponyfill/es2018/package.json +1 -1
  37. package/ponyfill/es6/package.json +1 -1
  38. package/ponyfill/package.json +1 -1
  39. package/types/polyfill.d.ts +29 -0
  40. package/{dist/types/ts3.6/polyfill.d.ts → types/ponyfill.d.ts} +57 -7
  41. package/{dist/types → types}/tsdoc-metadata.json +1 -1
  42. package/dist/types/polyfill.d.ts +0 -771
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020 Mattias Buelens
3
+ Copyright (c) 2024 Mattias Buelens
4
4
  Copyright (c) 2016 Diwank Singh Tomer
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
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
- ### Compatibility
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
- ### Compliance
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
- The polyfill implements [version `4b6b93c` (25 Oct 2021)][spec-snapshot] of the streams specification.
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, except for the ["bad buffers and views" tests for readable byte streams][wpt-bad-buffers].
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
- ### Contributors
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
- [spec-snapshot]: https://streams.spec.whatwg.org/commit-snapshots/4b6b93c69e531e2fe45a6ed4cb1484a7ba4eb8bb/
107
- [wpt]: https://github.com/web-platform-tests/wpt/tree/96ca25f0f7526282c0d47e6bf6a7edd439da1968/streams
108
- [wpt-bad-buffers]: https://github.com/web-platform-tests/wpt/blob/96ca25f0f7526282c0d47e6bf6a7edd439da1968/streams/readable-byte-streams/bad-buffers-and-views.any.js
109
- [proposal-arraybuffer-transfer]: https://github.com/domenic/proposal-arraybuffer-transfer
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