G-Earth 1.5.4 beta 22 - Initial release
Komplettes G-Earth Paket inkl. JRE, Extensions und Tools. Extensions: - G-BuildTools, G-Click Ultimate, G-Loader, G-Manipulate - G-Presets, G-Translator, G-Trigger, G-itemViewer - Market Utils, Packet Info Explorer, Plants - RandomRoomVisitor, RoomLogger, Sanbovir Photo Inspector - SpyFriends, WallAligner, XabboScripter, xabbo
This commit is contained in:
commit
368b92d87a
7984 files changed
+1373096
No files matched your search
+22
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2020 Mattias Buelens
|
||||
Copyright (c) 2016 Diwank Singh Tomer
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
# web-streams-polyfill
|
||||
|
||||
Web Streams, based on the WHATWG spec reference implementation.
|
||||
|
||||
[](https://travis-ci.com/MattiasBuelens/web-streams-polyfill)
|
||||
[](https://www.npmjs.com/package/web-streams-polyfill)
|
||||
[](https://github.com/MattiasBuelens/web-streams-polyfill/blob/master/LICENSE)
|
||||
[](https://gitter.im/web-streams-polyfill/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
## Links
|
||||
|
||||
- [Official spec][spec]
|
||||
- [Reference implementation][ref-impl]
|
||||
|
||||
## Usage
|
||||
|
||||
This library comes in multiple variants:
|
||||
* `web-streams-polyfill`: a polyfill that replaces the native stream implementations.
|
||||
Recommended for use in web apps supporting older browsers through a `<script>` tag.
|
||||
* `web-streams-polyfill/es6`: a polyfill targeting ES2015+ environments.
|
||||
Recommended for use in web apps supporting modern browsers through a `<script>` tag.
|
||||
* `web-streams-polyfill/es2018`: a polyfill targeting ES2018+ environments.
|
||||
* `web-streams-polyfill/ponyfill`: a [ponyfill] that provides
|
||||
the stream implementations without replacing any globals.
|
||||
Recommended for use in legacy Node applications, or in web libraries supporting older browsers.
|
||||
* `web-streams-polyfill/ponyfill/es6`: a ponyfill targeting ES2015+ environments.
|
||||
Recommended for use in Node 6+ applications, or in web libraries supporting modern browsers.
|
||||
* `web-streams-polyfill/ponyfill/es2018`: a ponyfill targeting ES2018+ environments.
|
||||
Recommended for use in Node 10+ applications.
|
||||
|
||||
Each variant also includes TypeScript type definitions, compatible with the DOM type definitions for streams included in TypeScript.
|
||||
|
||||
Usage as a polyfill:
|
||||
```html
|
||||
<!-- option 1: hosted by unpkg CDN -->
|
||||
<script src="https://unpkg.com/web-streams-polyfill/dist/polyfill.min.js"></script>
|
||||
<!-- option 2: self hosted -->
|
||||
<script src="/path/to/web-streams-polyfill/dist/polyfill.min.js"></script>
|
||||
<script>
|
||||
var readable = new ReadableStream();
|
||||
</script>
|
||||
```
|
||||
Usage as a Node module:
|
||||
```js
|
||||
var streams = require("web-streams-polyfill/ponyfill");
|
||||
var readable = new streams.ReadableStream();
|
||||
```
|
||||
Usage as a ES2015 module:
|
||||
```js
|
||||
import { ReadableStream } from "web-streams-polyfill/ponyfill";
|
||||
const readable = new ReadableStream();
|
||||
```
|
||||
|
||||
### Compatibility
|
||||
|
||||
The `polyfill` and `ponyfill` variants work in any ES5-compatible environment that has a global `Promise`.
|
||||
If you need to support older browsers or Node versions that do not have a native `Promise` implementation
|
||||
(check the [support table][promise-support]), you must first include a `Promise` polyfill
|
||||
(e.g. [promise-polyfill][promise-polyfill]).
|
||||
|
||||
The `polyfill/es6` and `ponyfill/es6` variants work in any ES2015-compatible environment.
|
||||
|
||||
The `polyfill/es2018` and `ponyfill/es2018` variants work in any ES2018-compatible environment.
|
||||
|
||||
[Async iterable support for `ReadableStream`][rs-asynciterator] is available in all variants, but requires an ES2018-compatible environment or a polyfill for `Symbol.asyncIterator`.
|
||||
|
||||
[`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].
|
||||
|
||||
### Compliance
|
||||
|
||||
The polyfill implements [version `4b6b93c` (25 Oct 2021)][spec-snapshot] of the streams specification.
|
||||
|
||||
The polyfill is tested against the same [web platform tests][wpt] that are used by browsers to test their native implementations.
|
||||
The polyfill aims to pass all tests, although it allows some exceptions for practical reasons:
|
||||
* The `es2018` variant passes all of the tests, except for the ["bad buffers and views" tests for readable byte streams][wpt-bad-buffers].
|
||||
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).
|
||||
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]).
|
||||
* 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].
|
||||
Retrieving the correct `%AsyncIteratorPrototype%` requires using an async generator (`async function* () {}`), which is invalid syntax before ES2018.
|
||||
Instead, the polyfill [creates its own version][stub-async-iterator-prototype] which is functionally equivalent to the real prototype.
|
||||
* The `es5` variant passes the same tests as the `es6` variant, except for various tests about specific characteristics of the constructors, properties and methods.
|
||||
These test failures do not affect the run-time behavior of the polyfill.
|
||||
For example:
|
||||
* The `name` property of down-leveled constructors is incorrect.
|
||||
* The `length` property of down-leveled constructors and methods with optional arguments is incorrect.
|
||||
* Not all properties and methods are correctly marked as non-enumerable.
|
||||
* Down-leveled class methods are not correctly marked as non-constructable.
|
||||
|
||||
The type definitions are compatible with the built-in stream types of TypeScript 3.3.
|
||||
|
||||
### Contributors
|
||||
|
||||
Thanks to these people for their work on [the original polyfill][creatorrr-polyfill]:
|
||||
|
||||
- Diwank Singh Tomer ([creatorrr](https://github.com/creatorrr))
|
||||
- Anders Riutta ([ariutta](https://github.com/ariutta))
|
||||
|
||||
[spec]: https://streams.spec.whatwg.org
|
||||
[ref-impl]: https://github.com/whatwg/streams
|
||||
[ponyfill]: https://github.com/sindresorhus/ponyfill
|
||||
[promise-support]: https://kangax.github.io/compat-table/es6/#test-Promise
|
||||
[promise-polyfill]: https://www.npmjs.com/package/promise-polyfill
|
||||
[rs-asynciterator]: https://streams.spec.whatwg.org/#rs-asynciterator
|
||||
[ws-controller-signal]: https://streams.spec.whatwg.org/#ws-default-controller-signal
|
||||
[abortcontroller-polyfill]: https://www.npmjs.com/package/abortcontroller-polyfill
|
||||
[spec-snapshot]: https://streams.spec.whatwg.org/commit-snapshots/4b6b93c69e531e2fe45a6ed4cb1484a7ba4eb8bb/
|
||||
[wpt]: https://github.com/web-platform-tests/wpt/tree/96ca25f0f7526282c0d47e6bf6a7edd439da1968/streams
|
||||
[wpt-bad-buffers]: https://github.com/web-platform-tests/wpt/blob/96ca25f0f7526282c0d47e6bf6a7edd439da1968/streams/readable-byte-streams/bad-buffers-and-views.any.js
|
||||
[proposal-arraybuffer-transfer]: https://github.com/domenic/proposal-arraybuffer-transfer
|
||||
[ref-impl-transferarraybuffer]: https://github.com/whatwg/streams/blob/4b6b93c69e531e2fe45a6ed4cb1484a7ba4eb8bb/reference-implementation/lib/abstract-ops/ecmascript.js#L16
|
||||
[issue-3]: https://github.com/MattiasBuelens/web-streams-polyfill/issues/3
|
||||
[wpt-async-iterator-prototype]: https://github.com/web-platform-tests/wpt/blob/96ca25f0f7526282c0d47e6bf6a7edd439da1968/streams/readable-streams/async-iterator.any.js#L24
|
||||
[stub-async-iterator-prototype]: https://github.com/MattiasBuelens/web-streams-polyfill/blob/v2.0.0/src/target/es5/stub/async-iterator-prototype.ts
|
||||
[creatorrr-polyfill]: https://github.com/creatorrr/web-streams-polyfill
|
||||
Generated
Vendored
+4241
File diff suppressed because it is too large.
Load diff
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"polyfill.es2018.js","sources":["../src/stub/symbol.ts","../src/utils.ts","../src/lib/helpers/miscellaneous.ts","../src/lib/helpers/webidl.ts","../src/lib/simple-queue.ts","../src/lib/readable-stream/generic-reader.ts","../src/lib/abstract-ops/internal-methods.ts","../src/stub/number-isfinite.ts","../src/stub/math-trunc.ts","../src/lib/validators/basic.ts","../src/lib/validators/readable-stream.ts","../src/lib/readable-stream/default-reader.ts","../src/target/es2018/stub/async-iterator-prototype.ts","../src/lib/readable-stream/async-iterator.ts","../src/stub/number-isnan.ts","../src/lib/abstract-ops/ecmascript.ts","../src/lib/abstract-ops/miscellaneous.ts","../src/lib/abstract-ops/queue-with-sizes.ts","../src/lib/readable-stream/byte-stream-controller.ts","../src/lib/readable-stream/byob-reader.ts","../src/lib/abstract-ops/queuing-strategy.ts","../src/lib/validators/queuing-strategy.ts","../src/lib/validators/underlying-sink.ts","../src/lib/validators/writable-stream.ts","../src/lib/abort-signal.ts","../src/lib/writable-stream.ts","../src/stub/native.ts","../src/stub/dom-exception.ts","../src/lib/readable-stream/pipe.ts","../src/lib/readable-stream/default-controller.ts","../src/lib/readable-stream/tee.ts","../src/lib/validators/underlying-source.ts","../src/lib/validators/reader-options.ts","../src/lib/validators/iterator-options.ts","../src/lib/validators/pipe-options.ts","../src/lib/validators/readable-writable-pair.ts","../src/lib/readable-stream.ts","../src/lib/validators/queuing-strategy-init.ts","../src/lib/byte-length-queuing-strategy.ts","../src/lib/count-queuing-strategy.ts","../src/lib/validators/transformer.ts","../src/lib/transform-stream.ts","../src/polyfill.ts"],"sourcesContent":["/// <reference lib=\"es2015.symbol\" />\n\nconst SymbolPolyfill: (description?: string) => symbol =\n typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?\n Symbol :\n description => `Symbol(${description})` as any as symbol;\n\nexport default SymbolPolyfill;\n","/// <reference lib=\"dom\" />\n\nexport function noop(): undefined {\n return undefined;\n}\n\nfunction getGlobals() {\n if (typeof self !== 'undefined') {\n return self;\n } else if (typeof window !== 'undefined') {\n return window;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n","import { globals } from '../../utils';\nimport { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseResolve = Promise.resolve.bind(originalPromise);\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\nexport function newPromise<T>(executor: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void\n) => void): Promise<T> {\n return new originalPromise(executor);\n}\n\nexport function promiseResolvedWith<T>(value: T | PromiseLike<T>): Promise<T> {\n return originalPromiseResolve(value);\n}\n\nexport function promiseRejectedWith<T = never>(reason: any): Promise<T> {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen<T, TResult1 = T, TResult2 = never>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>,\n onRejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise<TResult1 | TResult2>;\n}\n\nexport function uponPromise<T>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => void | PromiseLike<void>,\n onRejected?: (reason: any) => void | PromiseLike<void>): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment<T>(promise: Promise<T>, onFulfilled: (value: T) => void | PromiseLike<void>): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejectiLine truncated
|
||||
Generated
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WebStreamsPolyfill={})}(this,(function(e){"use strict";const t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol:e=>`Symbol(${e})`;function r(){}const o="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0;function n(e){return"object"==typeof e&&null!==e||"function"==typeof e}const a=r,i=Promise,l=Promise.prototype.then,s=Promise.resolve.bind(i),u=Promise.reject.bind(i);function c(e){return new i(e)}function d(e){return s(e)}function f(e){return u(e)}function b(e,t,r){return l.call(e,t,r)}function h(e,t,r){b(b(e,t,r),void 0,a)}function _(e,t){h(e,t)}function m(e,t){h(e,void 0,t)}function p(e,t,r){return b(e,t,r)}function y(e){b(e,void 0,a)}const g=(()=>{const e=o&&o.queueMicrotask;if("function"==typeof e)return e;const t=d(void 0);return e=>b(t,e)})();function S(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function v(e,t,r){try{return d(S(e,t,r))}catch(e){return f(e)}}class w{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(e){const t=this._back;let r=t;16383===t._elements.length&&(r={_elements:[],_next:void 0}),t._elements.push(e),r!==t&&(this._back=r,t._next=r),++this._size}shift(){const e=this._front;let t=e;const r=this._cursor;let o=r+1;const n=e._elements,a=n[r];return 16384===o&&(t=e._next,o=0),--this._size,this._cursor=o,e!==t&&(this._front=t),n[r]=void 0,a}forEach(e){let t=this._cursor,r=this._front,o=r._elements;for(;!(t===o.length&&void 0===r._next||t===o.length&&(r=r._next,o=r._elements,t=0,0===o.length));)e(o[t]),++t}peek(){const e=this._front,t=this._cursor;return e._elements[t]}}function R(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?q(e):"closed"===t._state?function(e){q(e),O(e)}(e):E(e,t._storedError)}function T(e,t){return br(e._ownerReadableStream,t)}function C(e){"readable"===e._ownerReadableStream._state?W(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e,t){E(e,t)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),e._ownerReadableStream._reader=void 0,e._ownerReadableStream=void 0}function P(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function q(e){e._closedPromise=c(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r}))}function E(e,t){q(e),W(e,t)}function W(e,t){void 0!==e._closedPromise_reject&&(y(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function O(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const B=t("[[AbortSteps]]"),k=t("[[ErrorSteps]]"),j=t("[[CancelSteps]]"),A=t("[[PullSteps]]"),z=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},D=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function L(e,t){if(void 0!==e&&("object"!=typeof(r=e)&&"function"!=typeof r))throw new TypeError(`${t} is not an object.`);var r}function F(e,t){if("function"!=typeof e)throw new TypeError(`${t} is not a function.`)}function I(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(`${t} is not an object.`)}function $(e,t,r){if(void 0===e)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function M(e,t,r){if(void 0===e)throw new TypeError(`${t} is required in '${r}'.`)}function Q(e){return Number(e)}function Y(e){return 0===e?0:e}function x(e,t){const r=Number.MAX_SAFE_INTEGER;let o=Number(e);if(o=Y(o),!z(o))throw new TypeError(`${t} is not a finite number`);if(o=function(e){return Y(D(e))}(o),o<0||o>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return z(o)&&0!==o?o:0}function N(e,t){if(!dr(e))throw new TypeError(`${t} is not a ReadableStream.`)}function H(e){return new ReadableStreamDefaultReader(e)}function V(e,t){e._reader._readRequests.push(t)}function U(e,t,r){const o=e._reader._readRequests.shift();r?o._closeSteps():o._chunkSteps(t)}function G(e){return e._reader._readRequests.length}function X(e){const t=e._reader;return void 0!==t&&!!J(t)}class ReadableStreamDefaultReader{constructor(e){if($(e,1,"ReadableStreamDefaultReader"),N(e,"First parameter"),fr(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");R(this,e),this._readRequests=new w}get closed(){return J(this)?this._closedPromise:f(Z("closed"))}cancel(e){return J(this)?void 0===this._ownerReadableStream?f(P("cancel")):T(this,e):f(Z("cancel"))}read(){if(!J(this))return f(Z("read"));if(voLine truncated
|
||||
//# sourceMappingURL=polyfill.es2018.min.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"polyfill.es2018.min.js","sources":["../src/stub/symbol.ts","../src/utils.ts","../src/lib/helpers/miscellaneous.ts","../src/lib/helpers/webidl.ts","../src/lib/simple-queue.ts","../src/lib/readable-stream/generic-reader.ts","../src/lib/abstract-ops/internal-methods.ts","../src/stub/number-isfinite.ts","../src/stub/math-trunc.ts","../src/lib/validators/basic.ts","../src/lib/validators/readable-stream.ts","../src/lib/readable-stream/default-reader.ts","../src/target/es2018/stub/async-iterator-prototype.ts","../src/lib/readable-stream/async-iterator.ts","../src/stub/number-isnan.ts","../src/lib/abstract-ops/ecmascript.ts","../src/lib/abstract-ops/miscellaneous.ts","../src/lib/abstract-ops/queue-with-sizes.ts","../src/lib/readable-stream/byte-stream-controller.ts","../src/lib/readable-stream/byob-reader.ts","../src/lib/abstract-ops/queuing-strategy.ts","../src/lib/validators/queuing-strategy.ts","../src/lib/validators/underlying-sink.ts","../src/lib/validators/writable-stream.ts","../src/lib/abort-signal.ts","../src/lib/writable-stream.ts","../src/stub/native.ts","../src/stub/dom-exception.ts","../src/lib/readable-stream/pipe.ts","../src/lib/readable-stream/default-controller.ts","../src/lib/readable-stream/tee.ts","../src/lib/validators/underlying-source.ts","../src/lib/validators/reader-options.ts","../src/lib/validators/pipe-options.ts","../src/lib/readable-stream.ts","../src/lib/validators/readable-writable-pair.ts","../src/lib/validators/iterator-options.ts","../src/lib/validators/queuing-strategy-init.ts","../src/lib/byte-length-queuing-strategy.ts","../src/lib/count-queuing-strategy.ts","../src/lib/validators/transformer.ts","../src/lib/transform-stream.ts","../src/polyfill.ts"],"sourcesContent":["/// <reference lib=\"es2015.symbol\" />\n\nconst SymbolPolyfill: (description?: string) => symbol =\n typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?\n Symbol :\n description => `Symbol(${description})` as any as symbol;\n\nexport default SymbolPolyfill;\n","/// <reference lib=\"dom\" />\n\nexport function noop(): undefined {\n return undefined;\n}\n\nfunction getGlobals() {\n if (typeof self !== 'undefined') {\n return self;\n } else if (typeof window !== 'undefined') {\n return window;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n","import { globals } from '../../utils';\nimport { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseResolve = Promise.resolve.bind(originalPromise);\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\nexport function newPromise<T>(executor: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void\n) => void): Promise<T> {\n return new originalPromise(executor);\n}\n\nexport function promiseResolvedWith<T>(value: T | PromiseLike<T>): Promise<T> {\n return originalPromiseResolve(value);\n}\n\nexport function promiseRejectedWith<T = never>(reason: any): Promise<T> {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen<T, TResult1 = T, TResult2 = never>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>,\n onRejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise<TResult1 | TResult2>;\n}\n\nexport function uponPromise<T>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => void | PromiseLike<void>,\n onRejected?: (reason: any) => void | PromiseLike<void>): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment<T>(promise: Promise<T>, onFulfilled: (value: T) => void | PromiseLike<void>): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejLine truncated
|
||||
Generated
Vendored
+4219
File diff suppressed because it is too large.
Load diff
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"polyfill.es2018.mjs","sources":["../src/stub/symbol.ts","../src/utils.ts","../src/lib/helpers/miscellaneous.ts","../src/lib/helpers/webidl.ts","../src/lib/simple-queue.ts","../src/lib/readable-stream/generic-reader.ts","../src/lib/abstract-ops/internal-methods.ts","../src/stub/number-isfinite.ts","../src/stub/math-trunc.ts","../src/lib/validators/basic.ts","../src/lib/validators/readable-stream.ts","../src/lib/readable-stream/default-reader.ts","../src/target/es2018/stub/async-iterator-prototype.ts","../src/lib/readable-stream/async-iterator.ts","../src/stub/number-isnan.ts","../src/lib/abstract-ops/ecmascript.ts","../src/lib/abstract-ops/miscellaneous.ts","../src/lib/abstract-ops/queue-with-sizes.ts","../src/lib/readable-stream/byte-stream-controller.ts","../src/lib/readable-stream/byob-reader.ts","../src/lib/abstract-ops/queuing-strategy.ts","../src/lib/validators/queuing-strategy.ts","../src/lib/validators/underlying-sink.ts","../src/lib/validators/writable-stream.ts","../src/lib/abort-signal.ts","../src/lib/writable-stream.ts","../src/stub/native.ts","../src/stub/dom-exception.ts","../src/lib/readable-stream/pipe.ts","../src/lib/readable-stream/default-controller.ts","../src/lib/readable-stream/tee.ts","../src/lib/validators/underlying-source.ts","../src/lib/validators/reader-options.ts","../src/lib/validators/iterator-options.ts","../src/lib/validators/pipe-options.ts","../src/lib/validators/readable-writable-pair.ts","../src/lib/readable-stream.ts","../src/lib/validators/queuing-strategy-init.ts","../src/lib/byte-length-queuing-strategy.ts","../src/lib/count-queuing-strategy.ts","../src/lib/validators/transformer.ts","../src/lib/transform-stream.ts","../src/polyfill.ts"],"sourcesContent":["/// <reference lib=\"es2015.symbol\" />\n\nconst SymbolPolyfill: (description?: string) => symbol =\n typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?\n Symbol :\n description => `Symbol(${description})` as any as symbol;\n\nexport default SymbolPolyfill;\n","/// <reference lib=\"dom\" />\n\nexport function noop(): undefined {\n return undefined;\n}\n\nfunction getGlobals() {\n if (typeof self !== 'undefined') {\n return self;\n } else if (typeof window !== 'undefined') {\n return window;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n","import { globals } from '../../utils';\nimport { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseResolve = Promise.resolve.bind(originalPromise);\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\nexport function newPromise<T>(executor: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void\n) => void): Promise<T> {\n return new originalPromise(executor);\n}\n\nexport function promiseResolvedWith<T>(value: T | PromiseLike<T>): Promise<T> {\n return originalPromiseResolve(value);\n}\n\nexport function promiseRejectedWith<T = never>(reason: any): Promise<T> {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen<T, TResult1 = T, TResult2 = never>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>,\n onRejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise<TResult1 | TResult2>;\n}\n\nexport function uponPromise<T>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => void | PromiseLike<void>,\n onRejected?: (reason: any) => void | PromiseLike<void>): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment<T>(promise: Promise<T>, onFulfilled: (value: T) => void | PromiseLike<void>): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejectLine truncated
|
||||
Generated
Vendored
+4252
File diff suppressed because it is too large.
Load diff
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"polyfill.es6.js","sources":["../src/stub/symbol.ts","../src/utils.ts","../src/lib/helpers/miscellaneous.ts","../src/lib/helpers/webidl.ts","../src/lib/simple-queue.ts","../src/lib/readable-stream/generic-reader.ts","../src/lib/abstract-ops/internal-methods.ts","../src/stub/number-isfinite.ts","../src/stub/math-trunc.ts","../src/lib/validators/basic.ts","../src/lib/validators/readable-stream.ts","../src/lib/readable-stream/default-reader.ts","../src/target/es5/stub/async-iterator-prototype.ts","../src/lib/readable-stream/async-iterator.ts","../src/stub/number-isnan.ts","../src/lib/abstract-ops/ecmascript.ts","../src/lib/abstract-ops/miscellaneous.ts","../src/lib/abstract-ops/queue-with-sizes.ts","../src/lib/readable-stream/byte-stream-controller.ts","../src/lib/readable-stream/byob-reader.ts","../src/lib/abstract-ops/queuing-strategy.ts","../src/lib/validators/queuing-strategy.ts","../src/lib/validators/underlying-sink.ts","../src/lib/validators/writable-stream.ts","../src/lib/abort-signal.ts","../src/lib/writable-stream.ts","../src/stub/native.ts","../src/stub/dom-exception.ts","../src/lib/readable-stream/pipe.ts","../src/lib/readable-stream/default-controller.ts","../src/lib/readable-stream/tee.ts","../src/lib/validators/underlying-source.ts","../src/lib/validators/reader-options.ts","../src/lib/validators/iterator-options.ts","../src/lib/validators/pipe-options.ts","../src/lib/validators/readable-writable-pair.ts","../src/lib/readable-stream.ts","../src/lib/validators/queuing-strategy-init.ts","../src/lib/byte-length-queuing-strategy.ts","../src/lib/count-queuing-strategy.ts","../src/lib/validators/transformer.ts","../src/lib/transform-stream.ts","../src/polyfill.ts"],"sourcesContent":["/// <reference lib=\"es2015.symbol\" />\n\nconst SymbolPolyfill: (description?: string) => symbol =\n typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?\n Symbol :\n description => `Symbol(${description})` as any as symbol;\n\nexport default SymbolPolyfill;\n","/// <reference lib=\"dom\" />\n\nexport function noop(): undefined {\n return undefined;\n}\n\nfunction getGlobals() {\n if (typeof self !== 'undefined') {\n return self;\n } else if (typeof window !== 'undefined') {\n return window;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n","import { globals } from '../../utils';\nimport { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseResolve = Promise.resolve.bind(originalPromise);\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\nexport function newPromise<T>(executor: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void\n) => void): Promise<T> {\n return new originalPromise(executor);\n}\n\nexport function promiseResolvedWith<T>(value: T | PromiseLike<T>): Promise<T> {\n return originalPromiseResolve(value);\n}\n\nexport function promiseRejectedWith<T = never>(reason: any): Promise<T> {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen<T, TResult1 = T, TResult2 = never>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>,\n onRejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise<TResult1 | TResult2>;\n}\n\nexport function uponPromise<T>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => void | PromiseLike<void>,\n onRejected?: (reason: any) => void | PromiseLike<void>): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment<T>(promise: Promise<T>, onFulfilled: (value: T) => void | PromiseLike<void>): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejection(proLine truncated
|
||||
Generated
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WebStreamsPolyfill={})}(this,(function(e){"use strict";const t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol:e=>`Symbol(${e})`;function r(){}const o="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0;function n(e){return"object"==typeof e&&null!==e||"function"==typeof e}const a=r,i=Promise,l=Promise.prototype.then,s=Promise.resolve.bind(i),u=Promise.reject.bind(i);function c(e){return new i(e)}function d(e){return s(e)}function f(e){return u(e)}function b(e,t,r){return l.call(e,t,r)}function h(e,t,r){b(b(e,t,r),void 0,a)}function _(e,t){h(e,t)}function m(e,t){h(e,void 0,t)}function p(e,t,r){return b(e,t,r)}function y(e){b(e,void 0,a)}const S=(()=>{const e=o&&o.queueMicrotask;if("function"==typeof e)return e;const t=d(void 0);return e=>b(t,e)})();function g(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function v(e,t,r){try{return d(g(e,t,r))}catch(e){return f(e)}}class w{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(e){const t=this._back;let r=t;16383===t._elements.length&&(r={_elements:[],_next:void 0}),t._elements.push(e),r!==t&&(this._back=r,t._next=r),++this._size}shift(){const e=this._front;let t=e;const r=this._cursor;let o=r+1;const n=e._elements,a=n[r];return 16384===o&&(t=e._next,o=0),--this._size,this._cursor=o,e!==t&&(this._front=t),n[r]=void 0,a}forEach(e){let t=this._cursor,r=this._front,o=r._elements;for(;!(t===o.length&&void 0===r._next||t===o.length&&(r=r._next,o=r._elements,t=0,0===o.length));)e(o[t]),++t}peek(){const e=this._front,t=this._cursor;return e._elements[t]}}function R(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?q(e):"closed"===t._state?function(e){q(e),O(e)}(e):E(e,t._storedError)}function T(e,t){return br(e._ownerReadableStream,t)}function C(e){"readable"===e._ownerReadableStream._state?W(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e,t){E(e,t)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),e._ownerReadableStream._reader=void 0,e._ownerReadableStream=void 0}function P(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function q(e){e._closedPromise=c(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r}))}function E(e,t){q(e),W(e,t)}function W(e,t){void 0!==e._closedPromise_reject&&(y(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function O(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const B=t("[[AbortSteps]]"),k=t("[[ErrorSteps]]"),j=t("[[CancelSteps]]"),A=t("[[PullSteps]]"),z=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},D=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function I(e,t){if(void 0!==e&&("object"!=typeof(r=e)&&"function"!=typeof r))throw new TypeError(`${t} is not an object.`);var r}function L(e,t){if("function"!=typeof e)throw new TypeError(`${t} is not a function.`)}function F(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(`${t} is not an object.`)}function $(e,t,r){if(void 0===e)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function M(e,t,r){if(void 0===e)throw new TypeError(`${t} is required in '${r}'.`)}function Q(e){return Number(e)}function Y(e){return 0===e?0:e}function x(e,t){const r=Number.MAX_SAFE_INTEGER;let o=Number(e);if(o=Y(o),!z(o))throw new TypeError(`${t} is not a finite number`);if(o=function(e){return Y(D(e))}(o),o<0||o>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return z(o)&&0!==o?o:0}function N(e,t){if(!dr(e))throw new TypeError(`${t} is not a ReadableStream.`)}function H(e){return new ReadableStreamDefaultReader(e)}function V(e,t){e._reader._readRequests.push(t)}function U(e,t,r){const o=e._reader._readRequests.shift();r?o._closeSteps():o._chunkSteps(t)}function G(e){return e._reader._readRequests.length}function X(e){const t=e._reader;return void 0!==t&&!!J(t)}class ReadableStreamDefaultReader{constructor(e){if($(e,1,"ReadableStreamDefaultReader"),N(e,"First parameter"),fr(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");R(this,e),this._readRequests=new w}get closed(){return J(this)?this._closedPromise:f(Z("closed"))}cancel(e){return J(this)?void 0===this._ownerReadableStream?f(P("cancel")):T(this,e):f(Z("cancel"))}read(){if(!J(this))return f(Z("read"));if(voLine truncated
|
||||
//# sourceMappingURL=polyfill.es6.min.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"polyfill.es6.min.js","sources":["../src/stub/symbol.ts","../src/utils.ts","../src/lib/helpers/miscellaneous.ts","../src/lib/helpers/webidl.ts","../src/lib/simple-queue.ts","../src/lib/readable-stream/generic-reader.ts","../src/lib/abstract-ops/internal-methods.ts","../src/stub/number-isfinite.ts","../src/stub/math-trunc.ts","../src/lib/validators/basic.ts","../src/lib/validators/readable-stream.ts","../src/lib/readable-stream/default-reader.ts","../src/target/es5/stub/async-iterator-prototype.ts","../src/lib/readable-stream/async-iterator.ts","../src/stub/number-isnan.ts","../src/lib/abstract-ops/ecmascript.ts","../src/lib/abstract-ops/miscellaneous.ts","../src/lib/abstract-ops/queue-with-sizes.ts","../src/lib/readable-stream/byte-stream-controller.ts","../src/lib/readable-stream/byob-reader.ts","../src/lib/abstract-ops/queuing-strategy.ts","../src/lib/validators/queuing-strategy.ts","../src/lib/validators/underlying-sink.ts","../src/lib/validators/writable-stream.ts","../src/lib/abort-signal.ts","../src/lib/writable-stream.ts","../src/stub/native.ts","../src/stub/dom-exception.ts","../src/lib/readable-stream/pipe.ts","../src/lib/readable-stream/default-controller.ts","../src/lib/readable-stream/tee.ts","../src/lib/validators/underlying-source.ts","../src/lib/validators/reader-options.ts","../src/lib/validators/pipe-options.ts","../src/lib/readable-stream.ts","../src/lib/validators/readable-writable-pair.ts","../src/lib/validators/iterator-options.ts","../src/lib/validators/queuing-strategy-init.ts","../src/lib/byte-length-queuing-strategy.ts","../src/lib/count-queuing-strategy.ts","../src/lib/validators/transformer.ts","../src/lib/transform-stream.ts","../src/polyfill.ts"],"sourcesContent":["/// <reference lib=\"es2015.symbol\" />\n\nconst SymbolPolyfill: (description?: string) => symbol =\n typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?\n Symbol :\n description => `Symbol(${description})` as any as symbol;\n\nexport default SymbolPolyfill;\n","/// <reference lib=\"dom\" />\n\nexport function noop(): undefined {\n return undefined;\n}\n\nfunction getGlobals() {\n if (typeof self !== 'undefined') {\n return self;\n } else if (typeof window !== 'undefined') {\n return window;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n","import { globals } from '../../utils';\nimport { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseResolve = Promise.resolve.bind(originalPromise);\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\nexport function newPromise<T>(executor: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void\n) => void): Promise<T> {\n return new originalPromise(executor);\n}\n\nexport function promiseResolvedWith<T>(value: T | PromiseLike<T>): Promise<T> {\n return originalPromiseResolve(value);\n}\n\nexport function promiseRejectedWith<T = never>(reason: any): Promise<T> {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen<T, TResult1 = T, TResult2 = never>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>,\n onRejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise<TResult1 | TResult2>;\n}\n\nexport function uponPromise<T>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => void | PromiseLike<void>,\n onRejected?: (reason: any) => void | PromiseLike<void>): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment<T>(promise: Promise<T>, onFulfilled: (value: T) => void | PromiseLike<void>): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejectionLine truncated
|
||||
Generated
Vendored
+4230
File diff suppressed because it is too large.
Load diff
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"polyfill.es6.mjs","sources":["../src/stub/symbol.ts","../src/utils.ts","../src/lib/helpers/miscellaneous.ts","../src/lib/helpers/webidl.ts","../src/lib/simple-queue.ts","../src/lib/readable-stream/generic-reader.ts","../src/lib/abstract-ops/internal-methods.ts","../src/stub/number-isfinite.ts","../src/stub/math-trunc.ts","../src/lib/validators/basic.ts","../src/lib/validators/readable-stream.ts","../src/lib/readable-stream/default-reader.ts","../src/target/es5/stub/async-iterator-prototype.ts","../src/lib/readable-stream/async-iterator.ts","../src/stub/number-isnan.ts","../src/lib/abstract-ops/ecmascript.ts","../src/lib/abstract-ops/miscellaneous.ts","../src/lib/abstract-ops/queue-with-sizes.ts","../src/lib/readable-stream/byte-stream-controller.ts","../src/lib/readable-stream/byob-reader.ts","../src/lib/abstract-ops/queuing-strategy.ts","../src/lib/validators/queuing-strategy.ts","../src/lib/validators/underlying-sink.ts","../src/lib/validators/writable-stream.ts","../src/lib/abort-signal.ts","../src/lib/writable-stream.ts","../src/stub/native.ts","../src/stub/dom-exception.ts","../src/lib/readable-stream/pipe.ts","../src/lib/readable-stream/default-controller.ts","../src/lib/readable-stream/tee.ts","../src/lib/validators/underlying-source.ts","../src/lib/validators/reader-options.ts","../src/lib/validators/iterator-options.ts","../src/lib/validators/pipe-options.ts","../src/lib/validators/readable-writable-pair.ts","../src/lib/readable-stream.ts","../src/lib/validators/queuing-strategy-init.ts","../src/lib/byte-length-queuing-strategy.ts","../src/lib/count-queuing-strategy.ts","../src/lib/validators/transformer.ts","../src/lib/transform-stream.ts","../src/polyfill.ts"],"sourcesContent":["/// <reference lib=\"es2015.symbol\" />\n\nconst SymbolPolyfill: (description?: string) => symbol =\n typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?\n Symbol :\n description => `Symbol(${description})` as any as symbol;\n\nexport default SymbolPolyfill;\n","/// <reference lib=\"dom\" />\n\nexport function noop(): undefined {\n return undefined;\n}\n\nfunction getGlobals() {\n if (typeof self !== 'undefined') {\n return self;\n } else if (typeof window !== 'undefined') {\n return window;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n","import { globals } from '../../utils';\nimport { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseResolve = Promise.resolve.bind(originalPromise);\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\nexport function newPromise<T>(executor: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void\n) => void): Promise<T> {\n return new originalPromise(executor);\n}\n\nexport function promiseResolvedWith<T>(value: T | PromiseLike<T>): Promise<T> {\n return originalPromiseResolve(value);\n}\n\nexport function promiseRejectedWith<T = never>(reason: any): Promise<T> {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen<T, TResult1 = T, TResult2 = never>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>,\n onRejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise<TResult1 | TResult2>;\n}\n\nexport function uponPromise<T>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => void | PromiseLike<void>,\n onRejected?: (reason: any) => void | PromiseLike<void>): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment<T>(promise: Promise<T>, onFulfilled: (value: T) => void | PromiseLike<void>): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejection(prLine truncated
|
||||
Generated
Vendored
+4382
File diff suppressed because it is too large.
Load diff
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"polyfill.js","sources":["../src/stub/symbol.ts","../src/utils.ts","../src/lib/helpers/miscellaneous.ts","../src/lib/helpers/webidl.ts","../src/lib/simple-queue.ts","../src/lib/readable-stream/generic-reader.ts","../src/lib/abstract-ops/internal-methods.ts","../src/stub/number-isfinite.ts","../src/stub/math-trunc.ts","../src/lib/validators/basic.ts","../src/lib/validators/readable-stream.ts","../src/lib/readable-stream/default-reader.ts","../src/target/es5/stub/async-iterator-prototype.ts","../src/lib/readable-stream/async-iterator.ts","../src/stub/number-isnan.ts","../src/lib/abstract-ops/ecmascript.ts","../src/lib/abstract-ops/miscellaneous.ts","../src/lib/abstract-ops/queue-with-sizes.ts","../src/lib/readable-stream/byte-stream-controller.ts","../src/lib/readable-stream/byob-reader.ts","../src/lib/abstract-ops/queuing-strategy.ts","../src/lib/validators/queuing-strategy.ts","../src/lib/validators/underlying-sink.ts","../src/lib/validators/writable-stream.ts","../src/lib/abort-signal.ts","../src/lib/writable-stream.ts","../src/stub/native.ts","../src/stub/dom-exception.ts","../src/lib/readable-stream/pipe.ts","../src/lib/readable-stream/default-controller.ts","../src/lib/readable-stream/tee.ts","../src/lib/validators/underlying-source.ts","../src/lib/validators/reader-options.ts","../src/lib/validators/iterator-options.ts","../src/lib/validators/pipe-options.ts","../src/lib/validators/readable-writable-pair.ts","../src/lib/readable-stream.ts","../src/lib/validators/queuing-strategy-init.ts","../src/lib/byte-length-queuing-strategy.ts","../src/lib/count-queuing-strategy.ts","../src/lib/validators/transformer.ts","../src/lib/transform-stream.ts","../src/polyfill.ts"],"sourcesContent":["/// <reference lib=\"es2015.symbol\" />\n\nconst SymbolPolyfill: (description?: string) => symbol =\n typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?\n Symbol :\n description => `Symbol(${description})` as any as symbol;\n\nexport default SymbolPolyfill;\n","/// <reference lib=\"dom\" />\n\nexport function noop(): undefined {\n return undefined;\n}\n\nfunction getGlobals() {\n if (typeof self !== 'undefined') {\n return self;\n } else if (typeof window !== 'undefined') {\n return window;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n","import { globals } from '../../utils';\nimport { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseResolve = Promise.resolve.bind(originalPromise);\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\nexport function newPromise<T>(executor: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void\n) => void): Promise<T> {\n return new originalPromise(executor);\n}\n\nexport function promiseResolvedWith<T>(value: T | PromiseLike<T>): Promise<T> {\n return originalPromiseResolve(value);\n}\n\nexport function promiseRejectedWith<T = never>(reason: any): Promise<T> {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen<T, TResult1 = T, TResult2 = never>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>,\n onRejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise<TResult1 | TResult2>;\n}\n\nexport function uponPromise<T>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => void | PromiseLike<void>,\n onRejected?: (reason: any) => void | PromiseLike<void>): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment<T>(promise: Promise<T>, onFulfilled: (value: T) => void | PromiseLike<void>): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejection(promiseLine truncated
|
||||
Generated
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).WebStreamsPolyfill={})}(this,(function(e){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol:function(e){return"Symbol("+e+")"};function t(){}var o="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0;function n(e){return"object"==typeof e&&null!==e||"function"==typeof e}var a=t,i=Promise,l=Promise.prototype.then,u=Promise.resolve.bind(i),s=Promise.reject.bind(i);function c(e){return new i(e)}function d(e){return u(e)}function f(e){return s(e)}function b(e,r,t){return l.call(e,r,t)}function p(e,r,t){b(b(e,r,t),void 0,a)}function _(e,r){p(e,r)}function h(e,r){p(e,void 0,r)}function m(e,r,t){return b(e,r,t)}function y(e){b(e,void 0,a)}var v=function(){var e=o&&o.queueMicrotask;if("function"==typeof e)return e;var r=d(void 0);return function(e){return b(r,e)}}();function g(e,r,t){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,r,t)}function S(e,r,t){try{return d(g(e,r,t))}catch(e){return f(e)}}var w=function(){function e(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._size},enumerable:!1,configurable:!0}),e.prototype.push=function(e){var r=this._back,t=r;16383===r._elements.length&&(t={_elements:[],_next:void 0}),r._elements.push(e),t!==r&&(this._back=t,r._next=t),++this._size},e.prototype.shift=function(){var e=this._front,r=e,t=this._cursor,o=t+1,n=e._elements,a=n[t];return 16384===o&&(r=e._next,o=0),--this._size,this._cursor=o,e!==r&&(this._front=r),n[t]=void 0,a},e.prototype.forEach=function(e){for(var r=this._cursor,t=this._front,o=t._elements;!(r===o.length&&void 0===t._next||r===o.length&&(r=0,0===(o=(t=t._next)._elements).length));)e(o[r]),++r},e.prototype.peek=function(){var e=this._front,r=this._cursor;return e._elements[r]},e}();function R(e,r){e._ownerReadableStream=r,r._reader=e,"readable"===r._state?q(e):"closed"===r._state?function(e){q(e),W(e)}(e):O(e,r._storedError)}function T(e,r){return Tt(e._ownerReadableStream,r)}function C(e){"readable"===e._ownerReadableStream._state?E(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e,r){O(e,r)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),e._ownerReadableStream._reader=void 0,e._ownerReadableStream=void 0}function P(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function q(e){e._closedPromise=c((function(r,t){e._closedPromise_resolve=r,e._closedPromise_reject=t}))}function O(e,r){q(e),E(e,r)}function E(e,r){void 0!==e._closedPromise_reject&&(y(e._closedPromise),e._closedPromise_reject(r),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function W(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}var j=r("[[AbortSteps]]"),B=r("[[ErrorSteps]]"),k=r("[[CancelSteps]]"),A=r("[[PullSteps]]"),z=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},D=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function I(e,r){if(void 0!==e&&("object"!=typeof(t=e)&&"function"!=typeof t))throw new TypeError(r+" is not an object.");var t}function F(e,r){if("function"!=typeof e)throw new TypeError(r+" is not a function.")}function L(e,r){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(r+" is not an object.")}function M(e,r,t){if(void 0===e)throw new TypeError("Parameter "+r+" is required in '"+t+"'.")}function Q(e,r,t){if(void 0===e)throw new TypeError(r+" is required in '"+t+"'.")}function Y(e){return Number(e)}function x(e){return 0===e?0:e}function N(e,r){var t=Number.MAX_SAFE_INTEGER,o=Number(e);if(o=x(o),!z(o))throw new TypeError(r+" is not a finite number");if((o=function(e){return x(D(e))}(o))<0||o>t)throw new TypeError(r+" is outside the accepted range of 0 to "+t+", inclusive");return z(o)&&0!==o?o:0}function H(e,r){if(!wt(e))throw new TypeError(r+" is not a ReadableStream.")}function V(e){return new $(e)}function U(e,r){e._reader._readRequests.push(r)}function G(e,r,t){var o=e._reader._readRequests.shift();t?o._closeSteps():o._chunkSteps(r)}function X(e){return e._reader._readRequests.length}function J(e){var r=e._reader;return void 0!==r&&!!ee(r)}var K,Z,$=function(){function ReadableStreamDefaultReader(e){if(M(e,1,"ReadableStreamDefaultReader"),H(e,"First parameter"),Rt(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");R(this,e),this._readRequests=new w}return Object.defineProperty(ReadableStreamDefaultReadeLine truncated
|
||||
//# sourceMappingURL=polyfill.min.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"polyfill.min.js","sources":["../src/stub/symbol.ts","../src/utils.ts","../src/lib/helpers/miscellaneous.ts","../src/lib/helpers/webidl.ts","../src/lib/simple-queue.ts","../src/lib/readable-stream/generic-reader.ts","../src/lib/abstract-ops/internal-methods.ts","../src/stub/number-isfinite.ts","../src/stub/math-trunc.ts","../src/lib/validators/basic.ts","../src/lib/validators/readable-stream.ts","../src/lib/readable-stream/default-reader.ts","../src/target/es5/stub/async-iterator-prototype.ts","../src/lib/readable-stream/async-iterator.ts","../src/stub/number-isnan.ts","../src/lib/abstract-ops/ecmascript.ts","../src/lib/abstract-ops/miscellaneous.ts","../src/lib/abstract-ops/queue-with-sizes.ts","../src/lib/readable-stream/byte-stream-controller.ts","../src/lib/readable-stream/byob-reader.ts","../src/lib/abstract-ops/queuing-strategy.ts","../src/lib/validators/queuing-strategy.ts","../src/lib/validators/underlying-sink.ts","../src/lib/validators/writable-stream.ts","../src/lib/abort-signal.ts","../src/lib/writable-stream.ts","../src/stub/native.ts","../src/stub/dom-exception.ts","../src/lib/readable-stream/pipe.ts","../src/lib/readable-stream/default-controller.ts","../src/lib/readable-stream/tee.ts","../src/lib/validators/underlying-source.ts","../src/lib/validators/reader-options.ts","../src/lib/validators/pipe-options.ts","../src/lib/readable-stream.ts","../src/lib/validators/readable-writable-pair.ts","../src/lib/validators/iterator-options.ts","../src/lib/validators/queuing-strategy-init.ts","../src/lib/byte-length-queuing-strategy.ts","../src/lib/count-queuing-strategy.ts","../src/lib/validators/transformer.ts","../src/lib/transform-stream.ts","../src/polyfill.ts"],"sourcesContent":["/// <reference lib=\"es2015.symbol\" />\n\nconst SymbolPolyfill: (description?: string) => symbol =\n typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?\n Symbol :\n description => `Symbol(${description})` as any as symbol;\n\nexport default SymbolPolyfill;\n","/// <reference lib=\"dom\" />\n\nexport function noop(): undefined {\n return undefined;\n}\n\nfunction getGlobals() {\n if (typeof self !== 'undefined') {\n return self;\n } else if (typeof window !== 'undefined') {\n return window;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n","import { globals } from '../../utils';\nimport { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseResolve = Promise.resolve.bind(originalPromise);\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\nexport function newPromise<T>(executor: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void\n) => void): Promise<T> {\n return new originalPromise(executor);\n}\n\nexport function promiseResolvedWith<T>(value: T | PromiseLike<T>): Promise<T> {\n return originalPromiseResolve(value);\n}\n\nexport function promiseRejectedWith<T = never>(reason: any): Promise<T> {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen<T, TResult1 = T, TResult2 = never>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>,\n onRejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise<TResult1 | TResult2>;\n}\n\nexport function uponPromise<T>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => void | PromiseLike<void>,\n onRejected?: (reason: any) => void | PromiseLike<void>): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment<T>(promise: Promise<T>, onFulfilled: (value: T) => void | PromiseLike<void>): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejection(proLine truncated
|
||||
Generated
Vendored
+4360
File diff suppressed because it is too large.
Load diff
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"polyfill.mjs","sources":["../src/stub/symbol.ts","../src/utils.ts","../src/lib/helpers/miscellaneous.ts","../src/lib/helpers/webidl.ts","../src/lib/simple-queue.ts","../src/lib/readable-stream/generic-reader.ts","../src/lib/abstract-ops/internal-methods.ts","../src/stub/number-isfinite.ts","../src/stub/math-trunc.ts","../src/lib/validators/basic.ts","../src/lib/validators/readable-stream.ts","../src/lib/readable-stream/default-reader.ts","../src/target/es5/stub/async-iterator-prototype.ts","../src/lib/readable-stream/async-iterator.ts","../src/stub/number-isnan.ts","../src/lib/abstract-ops/ecmascript.ts","../src/lib/abstract-ops/miscellaneous.ts","../src/lib/abstract-ops/queue-with-sizes.ts","../src/lib/readable-stream/byte-stream-controller.ts","../src/lib/readable-stream/byob-reader.ts","../src/lib/abstract-ops/queuing-strategy.ts","../src/lib/validators/queuing-strategy.ts","../src/lib/validators/underlying-sink.ts","../src/lib/validators/writable-stream.ts","../src/lib/abort-signal.ts","../src/lib/writable-stream.ts","../src/stub/native.ts","../src/stub/dom-exception.ts","../src/lib/readable-stream/pipe.ts","../src/lib/readable-stream/default-controller.ts","../src/lib/readable-stream/tee.ts","../src/lib/validators/underlying-source.ts","../src/lib/validators/reader-options.ts","../src/lib/validators/iterator-options.ts","../src/lib/validators/pipe-options.ts","../src/lib/validators/readable-writable-pair.ts","../src/lib/readable-stream.ts","../src/lib/validators/queuing-strategy-init.ts","../src/lib/byte-length-queuing-strategy.ts","../src/lib/count-queuing-strategy.ts","../src/lib/validators/transformer.ts","../src/lib/transform-stream.ts","../src/polyfill.ts"],"sourcesContent":["/// <reference lib=\"es2015.symbol\" />\n\nconst SymbolPolyfill: (description?: string) => symbol =\n typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?\n Symbol :\n description => `Symbol(${description})` as any as symbol;\n\nexport default SymbolPolyfill;\n","/// <reference lib=\"dom\" />\n\nexport function noop(): undefined {\n return undefined;\n}\n\nfunction getGlobals() {\n if (typeof self !== 'undefined') {\n return self;\n } else if (typeof window !== 'undefined') {\n return window;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n","import { globals } from '../../utils';\nimport { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseResolve = Promise.resolve.bind(originalPromise);\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\nexport function newPromise<T>(executor: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void\n) => void): Promise<T> {\n return new originalPromise(executor);\n}\n\nexport function promiseResolvedWith<T>(value: T | PromiseLike<T>): Promise<T> {\n return originalPromiseResolve(value);\n}\n\nexport function promiseRejectedWith<T = never>(reason: any): Promise<T> {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen<T, TResult1 = T, TResult2 = never>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>,\n onRejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise<TResult1 | TResult2>;\n}\n\nexport function uponPromise<T>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => void | PromiseLike<void>,\n onRejected?: (reason: any) => void | PromiseLike<void>): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment<T>(promise: Promise<T>, onFulfilled: (value: T) => void | PromiseLike<void>): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejection(promisLine truncated
|
||||
Generated
Vendored
+4213
File diff suppressed because it is too large.
Load diff
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ponyfill.es2018.js","sources":["../src/stub/symbol.ts","../src/utils.ts","../src/lib/helpers/miscellaneous.ts","../src/lib/helpers/webidl.ts","../src/lib/simple-queue.ts","../src/lib/readable-stream/generic-reader.ts","../src/lib/abstract-ops/internal-methods.ts","../src/stub/number-isfinite.ts","../src/stub/math-trunc.ts","../src/lib/validators/basic.ts","../src/lib/validators/readable-stream.ts","../src/lib/readable-stream/default-reader.ts","../src/target/es2018/stub/async-iterator-prototype.ts","../src/lib/readable-stream/async-iterator.ts","../src/stub/number-isnan.ts","../src/lib/abstract-ops/ecmascript.ts","../src/lib/abstract-ops/miscellaneous.ts","../src/lib/abstract-ops/queue-with-sizes.ts","../src/lib/readable-stream/byte-stream-controller.ts","../src/lib/readable-stream/byob-reader.ts","../src/lib/abstract-ops/queuing-strategy.ts","../src/lib/validators/queuing-strategy.ts","../src/lib/validators/underlying-sink.ts","../src/lib/validators/writable-stream.ts","../src/lib/abort-signal.ts","../src/lib/writable-stream.ts","../src/stub/native.ts","../src/stub/dom-exception.ts","../src/lib/readable-stream/pipe.ts","../src/lib/readable-stream/default-controller.ts","../src/lib/readable-stream/tee.ts","../src/lib/validators/underlying-source.ts","../src/lib/validators/reader-options.ts","../src/lib/validators/iterator-options.ts","../src/lib/validators/pipe-options.ts","../src/lib/validators/readable-writable-pair.ts","../src/lib/readable-stream.ts","../src/lib/validators/queuing-strategy-init.ts","../src/lib/byte-length-queuing-strategy.ts","../src/lib/count-queuing-strategy.ts","../src/lib/validators/transformer.ts","../src/lib/transform-stream.ts"],"sourcesContent":["/// <reference lib=\"es2015.symbol\" />\n\nconst SymbolPolyfill: (description?: string) => symbol =\n typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?\n Symbol :\n description => `Symbol(${description})` as any as symbol;\n\nexport default SymbolPolyfill;\n","/// <reference lib=\"dom\" />\n\nexport function noop(): undefined {\n return undefined;\n}\n\nfunction getGlobals() {\n if (typeof self !== 'undefined') {\n return self;\n } else if (typeof window !== 'undefined') {\n return window;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n","import { globals } from '../../utils';\nimport { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseResolve = Promise.resolve.bind(originalPromise);\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\nexport function newPromise<T>(executor: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void\n) => void): Promise<T> {\n return new originalPromise(executor);\n}\n\nexport function promiseResolvedWith<T>(value: T | PromiseLike<T>): Promise<T> {\n return originalPromiseResolve(value);\n}\n\nexport function promiseRejectedWith<T = never>(reason: any): Promise<T> {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen<T, TResult1 = T, TResult2 = never>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>,\n onRejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise<TResult1 | TResult2>;\n}\n\nexport function uponPromise<T>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => void | PromiseLike<void>,\n onRejected?: (reason: any) => void | PromiseLike<void>): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment<T>(promise: Promise<T>, onFulfilled: (value: T) => void | PromiseLike<void>): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejection(promise: Promise<uLine truncated
|
||||
Generated
Vendored
+4191
File diff suppressed because it is too large.
Load diff
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ponyfill.es2018.mjs","sources":["../src/stub/symbol.ts","../src/utils.ts","../src/lib/helpers/miscellaneous.ts","../src/lib/helpers/webidl.ts","../src/lib/simple-queue.ts","../src/lib/readable-stream/generic-reader.ts","../src/lib/abstract-ops/internal-methods.ts","../src/stub/number-isfinite.ts","../src/stub/math-trunc.ts","../src/lib/validators/basic.ts","../src/lib/validators/readable-stream.ts","../src/lib/readable-stream/default-reader.ts","../src/target/es2018/stub/async-iterator-prototype.ts","../src/lib/readable-stream/async-iterator.ts","../src/stub/number-isnan.ts","../src/lib/abstract-ops/ecmascript.ts","../src/lib/abstract-ops/miscellaneous.ts","../src/lib/abstract-ops/queue-with-sizes.ts","../src/lib/readable-stream/byte-stream-controller.ts","../src/lib/readable-stream/byob-reader.ts","../src/lib/abstract-ops/queuing-strategy.ts","../src/lib/validators/queuing-strategy.ts","../src/lib/validators/underlying-sink.ts","../src/lib/validators/writable-stream.ts","../src/lib/abort-signal.ts","../src/lib/writable-stream.ts","../src/stub/native.ts","../src/stub/dom-exception.ts","../src/lib/readable-stream/pipe.ts","../src/lib/readable-stream/default-controller.ts","../src/lib/readable-stream/tee.ts","../src/lib/validators/underlying-source.ts","../src/lib/validators/reader-options.ts","../src/lib/validators/iterator-options.ts","../src/lib/validators/pipe-options.ts","../src/lib/validators/readable-writable-pair.ts","../src/lib/readable-stream.ts","../src/lib/validators/queuing-strategy-init.ts","../src/lib/byte-length-queuing-strategy.ts","../src/lib/count-queuing-strategy.ts","../src/lib/validators/transformer.ts","../src/lib/transform-stream.ts"],"sourcesContent":["/// <reference lib=\"es2015.symbol\" />\n\nconst SymbolPolyfill: (description?: string) => symbol =\n typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?\n Symbol :\n description => `Symbol(${description})` as any as symbol;\n\nexport default SymbolPolyfill;\n","/// <reference lib=\"dom\" />\n\nexport function noop(): undefined {\n return undefined;\n}\n\nfunction getGlobals() {\n if (typeof self !== 'undefined') {\n return self;\n } else if (typeof window !== 'undefined') {\n return window;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n","import { globals } from '../../utils';\nimport { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseResolve = Promise.resolve.bind(originalPromise);\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\nexport function newPromise<T>(executor: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void\n) => void): Promise<T> {\n return new originalPromise(executor);\n}\n\nexport function promiseResolvedWith<T>(value: T | PromiseLike<T>): Promise<T> {\n return originalPromiseResolve(value);\n}\n\nexport function promiseRejectedWith<T = never>(reason: any): Promise<T> {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen<T, TResult1 = T, TResult2 = never>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>,\n onRejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise<TResult1 | TResult2>;\n}\n\nexport function uponPromise<T>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => void | PromiseLike<void>,\n onRejected?: (reason: any) => void | PromiseLike<void>): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment<T>(promise: Promise<T>, onFulfilled: (value: T) => void | PromiseLike<void>): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejection(promise: Promise<Line truncated
|
||||
Generated
Vendored
+4224
File diff suppressed because it is too large.
Load diff
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ponyfill.es6.js","sources":["../src/stub/symbol.ts","../src/utils.ts","../src/lib/helpers/miscellaneous.ts","../src/lib/helpers/webidl.ts","../src/lib/simple-queue.ts","../src/lib/readable-stream/generic-reader.ts","../src/lib/abstract-ops/internal-methods.ts","../src/stub/number-isfinite.ts","../src/stub/math-trunc.ts","../src/lib/validators/basic.ts","../src/lib/validators/readable-stream.ts","../src/lib/readable-stream/default-reader.ts","../src/target/es5/stub/async-iterator-prototype.ts","../src/lib/readable-stream/async-iterator.ts","../src/stub/number-isnan.ts","../src/lib/abstract-ops/ecmascript.ts","../src/lib/abstract-ops/miscellaneous.ts","../src/lib/abstract-ops/queue-with-sizes.ts","../src/lib/readable-stream/byte-stream-controller.ts","../src/lib/readable-stream/byob-reader.ts","../src/lib/abstract-ops/queuing-strategy.ts","../src/lib/validators/queuing-strategy.ts","../src/lib/validators/underlying-sink.ts","../src/lib/validators/writable-stream.ts","../src/lib/abort-signal.ts","../src/lib/writable-stream.ts","../src/stub/native.ts","../src/stub/dom-exception.ts","../src/lib/readable-stream/pipe.ts","../src/lib/readable-stream/default-controller.ts","../src/lib/readable-stream/tee.ts","../src/lib/validators/underlying-source.ts","../src/lib/validators/reader-options.ts","../src/lib/validators/iterator-options.ts","../src/lib/validators/pipe-options.ts","../src/lib/validators/readable-writable-pair.ts","../src/lib/readable-stream.ts","../src/lib/validators/queuing-strategy-init.ts","../src/lib/byte-length-queuing-strategy.ts","../src/lib/count-queuing-strategy.ts","../src/lib/validators/transformer.ts","../src/lib/transform-stream.ts"],"sourcesContent":["/// <reference lib=\"es2015.symbol\" />\n\nconst SymbolPolyfill: (description?: string) => symbol =\n typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?\n Symbol :\n description => `Symbol(${description})` as any as symbol;\n\nexport default SymbolPolyfill;\n","/// <reference lib=\"dom\" />\n\nexport function noop(): undefined {\n return undefined;\n}\n\nfunction getGlobals() {\n if (typeof self !== 'undefined') {\n return self;\n } else if (typeof window !== 'undefined') {\n return window;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n","import { globals } from '../../utils';\nimport { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseResolve = Promise.resolve.bind(originalPromise);\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\nexport function newPromise<T>(executor: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void\n) => void): Promise<T> {\n return new originalPromise(executor);\n}\n\nexport function promiseResolvedWith<T>(value: T | PromiseLike<T>): Promise<T> {\n return originalPromiseResolve(value);\n}\n\nexport function promiseRejectedWith<T = never>(reason: any): Promise<T> {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen<T, TResult1 = T, TResult2 = never>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>,\n onRejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise<TResult1 | TResult2>;\n}\n\nexport function uponPromise<T>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => void | PromiseLike<void>,\n onRejected?: (reason: any) => void | PromiseLike<void>): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment<T>(promise: Promise<T>, onFulfilled: (value: T) => void | PromiseLike<void>): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejection(promise: Promise<unknownLine truncated
|
||||
Generated
Vendored
+4202
File diff suppressed because it is too large.
Load diff
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ponyfill.es6.mjs","sources":["../src/stub/symbol.ts","../src/utils.ts","../src/lib/helpers/miscellaneous.ts","../src/lib/helpers/webidl.ts","../src/lib/simple-queue.ts","../src/lib/readable-stream/generic-reader.ts","../src/lib/abstract-ops/internal-methods.ts","../src/stub/number-isfinite.ts","../src/stub/math-trunc.ts","../src/lib/validators/basic.ts","../src/lib/validators/readable-stream.ts","../src/lib/readable-stream/default-reader.ts","../src/target/es5/stub/async-iterator-prototype.ts","../src/lib/readable-stream/async-iterator.ts","../src/stub/number-isnan.ts","../src/lib/abstract-ops/ecmascript.ts","../src/lib/abstract-ops/miscellaneous.ts","../src/lib/abstract-ops/queue-with-sizes.ts","../src/lib/readable-stream/byte-stream-controller.ts","../src/lib/readable-stream/byob-reader.ts","../src/lib/abstract-ops/queuing-strategy.ts","../src/lib/validators/queuing-strategy.ts","../src/lib/validators/underlying-sink.ts","../src/lib/validators/writable-stream.ts","../src/lib/abort-signal.ts","../src/lib/writable-stream.ts","../src/stub/native.ts","../src/stub/dom-exception.ts","../src/lib/readable-stream/pipe.ts","../src/lib/readable-stream/default-controller.ts","../src/lib/readable-stream/tee.ts","../src/lib/validators/underlying-source.ts","../src/lib/validators/reader-options.ts","../src/lib/validators/iterator-options.ts","../src/lib/validators/pipe-options.ts","../src/lib/validators/readable-writable-pair.ts","../src/lib/readable-stream.ts","../src/lib/validators/queuing-strategy-init.ts","../src/lib/byte-length-queuing-strategy.ts","../src/lib/count-queuing-strategy.ts","../src/lib/validators/transformer.ts","../src/lib/transform-stream.ts"],"sourcesContent":["/// <reference lib=\"es2015.symbol\" />\n\nconst SymbolPolyfill: (description?: string) => symbol =\n typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?\n Symbol :\n description => `Symbol(${description})` as any as symbol;\n\nexport default SymbolPolyfill;\n","/// <reference lib=\"dom\" />\n\nexport function noop(): undefined {\n return undefined;\n}\n\nfunction getGlobals() {\n if (typeof self !== 'undefined') {\n return self;\n } else if (typeof window !== 'undefined') {\n return window;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n","import { globals } from '../../utils';\nimport { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseResolve = Promise.resolve.bind(originalPromise);\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\nexport function newPromise<T>(executor: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void\n) => void): Promise<T> {\n return new originalPromise(executor);\n}\n\nexport function promiseResolvedWith<T>(value: T | PromiseLike<T>): Promise<T> {\n return originalPromiseResolve(value);\n}\n\nexport function promiseRejectedWith<T = never>(reason: any): Promise<T> {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen<T, TResult1 = T, TResult2 = never>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>,\n onRejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise<TResult1 | TResult2>;\n}\n\nexport function uponPromise<T>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => void | PromiseLike<void>,\n onRejected?: (reason: any) => void | PromiseLike<void>): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment<T>(promise: Promise<T>, onFulfilled: (value: T) => void | PromiseLike<void>): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejection(promise: Promise<unknowLine truncated
|
||||
Generated
Vendored
+4354
File diff suppressed because it is too large.
Load diff
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ponyfill.js","sources":["../src/stub/symbol.ts","../src/utils.ts","../src/lib/helpers/miscellaneous.ts","../src/lib/helpers/webidl.ts","../src/lib/simple-queue.ts","../src/lib/readable-stream/generic-reader.ts","../src/lib/abstract-ops/internal-methods.ts","../src/stub/number-isfinite.ts","../src/stub/math-trunc.ts","../src/lib/validators/basic.ts","../src/lib/validators/readable-stream.ts","../src/lib/readable-stream/default-reader.ts","../src/target/es5/stub/async-iterator-prototype.ts","../src/lib/readable-stream/async-iterator.ts","../src/stub/number-isnan.ts","../src/lib/abstract-ops/ecmascript.ts","../src/lib/abstract-ops/miscellaneous.ts","../src/lib/abstract-ops/queue-with-sizes.ts","../src/lib/readable-stream/byte-stream-controller.ts","../src/lib/readable-stream/byob-reader.ts","../src/lib/abstract-ops/queuing-strategy.ts","../src/lib/validators/queuing-strategy.ts","../src/lib/validators/underlying-sink.ts","../src/lib/validators/writable-stream.ts","../src/lib/abort-signal.ts","../src/lib/writable-stream.ts","../src/stub/native.ts","../src/stub/dom-exception.ts","../src/lib/readable-stream/pipe.ts","../src/lib/readable-stream/default-controller.ts","../src/lib/readable-stream/tee.ts","../src/lib/validators/underlying-source.ts","../src/lib/validators/reader-options.ts","../src/lib/validators/iterator-options.ts","../src/lib/validators/pipe-options.ts","../src/lib/validators/readable-writable-pair.ts","../src/lib/readable-stream.ts","../src/lib/validators/queuing-strategy-init.ts","../src/lib/byte-length-queuing-strategy.ts","../src/lib/count-queuing-strategy.ts","../src/lib/validators/transformer.ts","../src/lib/transform-stream.ts"],"sourcesContent":["/// <reference lib=\"es2015.symbol\" />\n\nconst SymbolPolyfill: (description?: string) => symbol =\n typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?\n Symbol :\n description => `Symbol(${description})` as any as symbol;\n\nexport default SymbolPolyfill;\n","/// <reference lib=\"dom\" />\n\nexport function noop(): undefined {\n return undefined;\n}\n\nfunction getGlobals() {\n if (typeof self !== 'undefined') {\n return self;\n } else if (typeof window !== 'undefined') {\n return window;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n","import { globals } from '../../utils';\nimport { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseResolve = Promise.resolve.bind(originalPromise);\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\nexport function newPromise<T>(executor: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void\n) => void): Promise<T> {\n return new originalPromise(executor);\n}\n\nexport function promiseResolvedWith<T>(value: T | PromiseLike<T>): Promise<T> {\n return originalPromiseResolve(value);\n}\n\nexport function promiseRejectedWith<T = never>(reason: any): Promise<T> {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen<T, TResult1 = T, TResult2 = never>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>,\n onRejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise<TResult1 | TResult2>;\n}\n\nexport function uponPromise<T>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => void | PromiseLike<void>,\n onRejected?: (reason: any) => void | PromiseLike<void>): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment<T>(promise: Promise<T>, onFulfilled: (value: T) => void | PromiseLike<void>): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejection(promise: Promise<unknown>, oLine truncated
|
||||
Generated
Vendored
+4332
File diff suppressed because it is too large.
Load diff
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ponyfill.mjs","sources":["../src/stub/symbol.ts","../src/utils.ts","../src/lib/helpers/miscellaneous.ts","../src/lib/helpers/webidl.ts","../src/lib/simple-queue.ts","../src/lib/readable-stream/generic-reader.ts","../src/lib/abstract-ops/internal-methods.ts","../src/stub/number-isfinite.ts","../src/stub/math-trunc.ts","../src/lib/validators/basic.ts","../src/lib/validators/readable-stream.ts","../src/lib/readable-stream/default-reader.ts","../src/target/es5/stub/async-iterator-prototype.ts","../src/lib/readable-stream/async-iterator.ts","../src/stub/number-isnan.ts","../src/lib/abstract-ops/ecmascript.ts","../src/lib/abstract-ops/miscellaneous.ts","../src/lib/abstract-ops/queue-with-sizes.ts","../src/lib/readable-stream/byte-stream-controller.ts","../src/lib/readable-stream/byob-reader.ts","../src/lib/abstract-ops/queuing-strategy.ts","../src/lib/validators/queuing-strategy.ts","../src/lib/validators/underlying-sink.ts","../src/lib/validators/writable-stream.ts","../src/lib/abort-signal.ts","../src/lib/writable-stream.ts","../src/stub/native.ts","../src/stub/dom-exception.ts","../src/lib/readable-stream/pipe.ts","../src/lib/readable-stream/default-controller.ts","../src/lib/readable-stream/tee.ts","../src/lib/validators/underlying-source.ts","../src/lib/validators/reader-options.ts","../src/lib/validators/iterator-options.ts","../src/lib/validators/pipe-options.ts","../src/lib/validators/readable-writable-pair.ts","../src/lib/readable-stream.ts","../src/lib/validators/queuing-strategy-init.ts","../src/lib/byte-length-queuing-strategy.ts","../src/lib/count-queuing-strategy.ts","../src/lib/validators/transformer.ts","../src/lib/transform-stream.ts"],"sourcesContent":["/// <reference lib=\"es2015.symbol\" />\n\nconst SymbolPolyfill: (description?: string) => symbol =\n typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ?\n Symbol :\n description => `Symbol(${description})` as any as symbol;\n\nexport default SymbolPolyfill;\n","/// <reference lib=\"dom\" />\n\nexport function noop(): undefined {\n return undefined;\n}\n\nfunction getGlobals() {\n if (typeof self !== 'undefined') {\n return self;\n } else if (typeof window !== 'undefined') {\n return window;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n","import { globals } from '../../utils';\nimport { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseResolve = Promise.resolve.bind(originalPromise);\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\nexport function newPromise<T>(executor: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void\n) => void): Promise<T> {\n return new originalPromise(executor);\n}\n\nexport function promiseResolvedWith<T>(value: T | PromiseLike<T>): Promise<T> {\n return originalPromiseResolve(value);\n}\n\nexport function promiseRejectedWith<T = never>(reason: any): Promise<T> {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen<T, TResult1 = T, TResult2 = never>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>,\n onRejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise<TResult1 | TResult2>;\n}\n\nexport function uponPromise<T>(\n promise: Promise<T>,\n onFulfilled?: (value: T) => void | PromiseLike<void>,\n onRejected?: (reason: any) => void | PromiseLike<void>): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment<T>(promise: Promise<T>, onFulfilled: (value: T) => void | PromiseLike<void>): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejection(promise: Promise<unknown>, Line truncated
|
||||
Generated
Vendored
+771
@@ -0,0 +1,771 @@
|
||||
/// <reference lib="esnext.asynciterable" />
|
||||
|
||||
/**
|
||||
* A signal object that allows you to communicate with a request and abort it if required
|
||||
* via its associated `AbortController` object.
|
||||
*
|
||||
* @remarks
|
||||
* This interface is compatible with the `AbortSignal` interface defined in TypeScript's DOM types.
|
||||
* It is redefined here, so it can be polyfilled without a DOM, for example with
|
||||
* {@link https://www.npmjs.com/package/abortcontroller-polyfill | abortcontroller-polyfill} in a Node environment.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface AbortSignal {
|
||||
/**
|
||||
* Whether the request is aborted.
|
||||
*/
|
||||
readonly aborted: boolean;
|
||||
/**
|
||||
* Add an event listener to be triggered when this signal becomes aborted.
|
||||
*/
|
||||
addEventListener(type: 'abort', listener: () => void): void;
|
||||
/**
|
||||
* Remove an event listener that was previously added with {@link AbortSignal.addEventListener}.
|
||||
*/
|
||||
removeEventListener(type: 'abort', listener: () => void): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A queuing strategy that counts the number of bytes in each chunk.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class ByteLengthQueuingStrategy implements QueuingStrategy<ArrayBufferView> {
|
||||
constructor(options: QueuingStrategyInit);
|
||||
/**
|
||||
* Returns the high water mark provided to the constructor.
|
||||
*/
|
||||
readonly highWaterMark: number;
|
||||
/**
|
||||
* Measures the size of `chunk` by returning the value of its `byteLength` property.
|
||||
*/
|
||||
readonly size: (chunk: ArrayBufferView) => number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A queuing strategy that counts the number of chunks.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class CountQueuingStrategy implements QueuingStrategy<any> {
|
||||
constructor(options: QueuingStrategyInit);
|
||||
/**
|
||||
* Returns the high water mark provided to the constructor.
|
||||
*/
|
||||
readonly highWaterMark: number;
|
||||
/**
|
||||
* Measures the size of `chunk` by always returning 1.
|
||||
* This ensures that the total queue size is a count of the number of chunks in the queue.
|
||||
*/
|
||||
readonly size: (chunk: any) => 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* A queuing strategy.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface QueuingStrategy<T = any> {
|
||||
/**
|
||||
* A non-negative number indicating the high water mark of the stream using this queuing strategy.
|
||||
*/
|
||||
highWaterMark?: number;
|
||||
/**
|
||||
* A function that computes and returns the finite non-negative size of the given chunk value.
|
||||
*/
|
||||
size?: QueuingStrategySizeCallback<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare interface QueuingStrategyInit {
|
||||
/**
|
||||
* {@inheritDoc QueuingStrategy.highWaterMark}
|
||||
*/
|
||||
highWaterMark: number;
|
||||
}
|
||||
|
||||
declare type QueuingStrategySizeCallback<T = any> = (chunk: T) => number;
|
||||
|
||||
declare type ReadableByteStream = ReadableStream<Uint8Array> & {
|
||||
_readableStreamController: ReadableByteStreamController;
|
||||
};
|
||||
|
||||
/**
|
||||
* Allows control of a {@link ReadableStream | readable byte stream}'s state and internal queue.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class ReadableByteStreamController {
|
||||
private constructor();
|
||||
/**
|
||||
* Returns the current BYOB pull request, or `null` if there isn't one.
|
||||
*/
|
||||
readonly byobRequest: ReadableStreamBYOBRequest | null;
|
||||
/**
|
||||
* Returns the desired size to fill the controlled stream's internal queue. It can be negative, if the queue is
|
||||
* over-full. An underlying byte source ought to use this information to determine when and how to apply backpressure.
|
||||
*/
|
||||
readonly desiredSize: number | null;
|
||||
/**
|
||||
* Closes the controlled readable stream. Consumers will still be able to read any previously-enqueued chunks from
|
||||
* the stream, but once those are read, the stream will become closed.
|
||||
*/
|
||||
close(): void;
|
||||
/**
|
||||
* Enqueues the given chunk chunk in the controlled readable stream.
|
||||
* The chunk has to be an `ArrayBufferView` instance, or else a `TypeError` will be thrown.
|
||||
*/
|
||||
enqueue(chunk: ArrayBufferView): void;
|
||||
/**
|
||||
* Errors the controlled readable stream, making all future interactions with it fail with the given error `e`.
|
||||
*/
|
||||
error(e?: any): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A readable stream represents a source of data, from which you can read.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class ReadableStream<R = any> {
|
||||
constructor(underlyingSource: UnderlyingByteSource, strategy?: {
|
||||
highWaterMark?: number;
|
||||
size?: undefined;
|
||||
});
|
||||
constructor(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>);
|
||||
/**
|
||||
* Whether or not the readable stream is locked to a {@link ReadableStreamDefaultReader | reader}.
|
||||
*/
|
||||
readonly locked: boolean;
|
||||
/**
|
||||
* Cancels the stream, signaling a loss of interest in the stream by a consumer.
|
||||
*
|
||||
* The supplied `reason` argument will be given to the underlying source's {@link UnderlyingSource.cancel | cancel()}
|
||||
* method, which might or might not use it.
|
||||
*/
|
||||
cancel(reason?: any): Promise<void>;
|
||||
/**
|
||||
* Creates a {@link ReadableStreamBYOBReader} and locks the stream to the new reader.
|
||||
*
|
||||
* This call behaves the same way as the no-argument variant, except that it only works on readable byte streams,
|
||||
* i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading.
|
||||
* The returned BYOB reader provides the ability to directly read individual chunks from the stream via its
|
||||
* {@link ReadableStreamBYOBReader.read | read()} method, into developer-supplied buffers, allowing more precise
|
||||
* control over allocation.
|
||||
*/
|
||||
getReader({ mode }: {
|
||||
mode: 'byob';
|
||||
}): ReadableStreamBYOBReader;
|
||||
/**
|
||||
* Creates a {@link ReadableStreamDefaultReader} and locks the stream to the new reader.
|
||||
* While the stream is locked, no other reader can be acquired until this one is released.
|
||||
*
|
||||
* This functionality is especially useful for creating abstractions that desire the ability to consume a stream
|
||||
* in its entirety. By getting a reader for the stream, you can ensure nobody else can interleave reads with yours
|
||||
* or cancel the stream, which would interfere with your abstraction.
|
||||
*/
|
||||
getReader(): ReadableStreamDefaultReader<R>;
|
||||
/**
|
||||
* Provides a convenient, chainable way of piping this readable stream through a transform stream
|
||||
* (or any other `{ writable, readable }` pair). It simply {@link ReadableStream.pipeTo | pipes} the stream
|
||||
* into the writable side of the supplied pair, and returns the readable side for further use.
|
||||
*
|
||||
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
|
||||
*/
|
||||
pipeThrough<RS extends ReadableStream>(transform: {
|
||||
readable: RS;
|
||||
writable: WritableStream<R>;
|
||||
}, options?: StreamPipeOptions): RS;
|
||||
/**
|
||||
* Pipes this readable stream to a given writable stream. The way in which the piping process behaves under
|
||||
* various error conditions can be customized with a number of passed options. It returns a promise that fulfills
|
||||
* when the piping process completes successfully, or rejects if any errors were encountered.
|
||||
*
|
||||
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
|
||||
*/
|
||||
pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
|
||||
/**
|
||||
* Tees this readable stream, returning a two-element array containing the two resulting branches as
|
||||
* new {@link ReadableStream} instances.
|
||||
*
|
||||
* Teeing a stream will lock it, preventing any other consumer from acquiring a reader.
|
||||
* To cancel the stream, cancel both of the resulting branches; a composite cancellation reason will then be
|
||||
* propagated to the stream's underlying source.
|
||||
*
|
||||
* Note that the chunks seen in each branch will be the same object. If the chunks are not immutable,
|
||||
* this could allow interference between the two branches.
|
||||
*/
|
||||
tee(): [ReadableStream<R>, ReadableStream<R>];
|
||||
/**
|
||||
* Asynchronously iterates over the chunks in the stream's internal queue.
|
||||
*
|
||||
* Asynchronously iterating over the stream will lock it, preventing any other consumer from acquiring a reader.
|
||||
* The lock will be released if the async iterator's {@link ReadableStreamAsyncIterator.return | return()} method
|
||||
* is called, e.g. by breaking out of the loop.
|
||||
*
|
||||
* By default, calling the async iterator's {@link ReadableStreamAsyncIterator.return | return()} method will also
|
||||
* cancel the stream. To prevent this, use the stream's {@link ReadableStream.values | values()} method, passing
|
||||
* `true` for the `preventCancel` option.
|
||||
*/
|
||||
values(options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator<R>;
|
||||
/**
|
||||
* {@inheritDoc ReadableStream.values}
|
||||
*/
|
||||
[Symbol.asyncIterator]: (options?: ReadableStreamIteratorOptions) => ReadableStreamAsyncIterator<R>;
|
||||
}
|
||||
|
||||
/**
|
||||
* An async iterator returned by {@link ReadableStream.values}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface ReadableStreamAsyncIterator<R> extends AsyncIterator<R> {
|
||||
next(): Promise<IteratorResult<R, undefined>>;
|
||||
return(value?: any): Promise<IteratorResult<any>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A BYOB reader vended by a {@link ReadableStream}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class ReadableStreamBYOBReader {
|
||||
constructor(stream: ReadableByteStream);
|
||||
/**
|
||||
* Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or
|
||||
* the reader's lock is released before the stream finishes closing.
|
||||
*/
|
||||
readonly closed: Promise<undefined>;
|
||||
/**
|
||||
* If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.
|
||||
*/
|
||||
cancel(reason?: any): Promise<void>;
|
||||
/**
|
||||
* Attempts to reads bytes into view, and returns a promise resolved with the result.
|
||||
*
|
||||
* If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.
|
||||
*/
|
||||
read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamBYOBReadResult<T>>;
|
||||
/**
|
||||
* Releases the reader's lock on the corresponding stream. After the lock is released, the reader is no longer active.
|
||||
* If the associated stream is errored when the lock is released, the reader will appear errored in the same way
|
||||
* from now on; otherwise, the reader will appear closed.
|
||||
*
|
||||
* A reader's lock cannot be released while it still has a pending read request, i.e., if a promise returned by
|
||||
* the reader's {@link ReadableStreamBYOBReader.read | read()} method has not yet been settled. Attempting to
|
||||
* do so will throw a `TypeError` and leave the reader locked to the stream.
|
||||
*/
|
||||
releaseLock(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A result returned by {@link ReadableStreamBYOBReader.read}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare type ReadableStreamBYOBReadResult<T extends ArrayBufferView> = {
|
||||
done: false;
|
||||
value: T;
|
||||
} | {
|
||||
done: true;
|
||||
value: T | undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* A pull-into request in a {@link ReadableByteStreamController}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class ReadableStreamBYOBRequest {
|
||||
private constructor();
|
||||
/**
|
||||
* Returns the view for writing in to, or `null` if the BYOB request has already been responded to.
|
||||
*/
|
||||
readonly view: ArrayBufferView | null;
|
||||
/**
|
||||
* Indicates to the associated readable byte stream that `bytesWritten` bytes were written into
|
||||
* {@link ReadableStreamBYOBRequest.view | view}, causing the result be surfaced to the consumer.
|
||||
*
|
||||
* After this method is called, {@link ReadableStreamBYOBRequest.view | view} will be transferred and no longer
|
||||
* modifiable.
|
||||
*/
|
||||
respond(bytesWritten: number): void;
|
||||
/**
|
||||
* Indicates to the associated readable byte stream that instead of writing into
|
||||
* {@link ReadableStreamBYOBRequest.view | view}, the underlying byte source is providing a new `ArrayBufferView`,
|
||||
* which will be given to the consumer of the readable byte stream.
|
||||
*
|
||||
* After this method is called, `view` will be transferred and no longer modifiable.
|
||||
*/
|
||||
respondWithNewView(view: ArrayBufferView): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows control of a {@link ReadableStream | readable stream}'s state and internal queue.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class ReadableStreamDefaultController<R> {
|
||||
private constructor();
|
||||
/**
|
||||
* Returns the desired size to fill the controlled stream's internal queue. It can be negative, if the queue is
|
||||
* over-full. An underlying source ought to use this information to determine when and how to apply backpressure.
|
||||
*/
|
||||
readonly desiredSize: number | null;
|
||||
/**
|
||||
* Closes the controlled readable stream. Consumers will still be able to read any previously-enqueued chunks from
|
||||
* the stream, but once those are read, the stream will become closed.
|
||||
*/
|
||||
close(): void;
|
||||
/**
|
||||
* Enqueues the given chunk `chunk` in the controlled readable stream.
|
||||
*/
|
||||
enqueue(chunk: R): void;
|
||||
/**
|
||||
* Errors the controlled readable stream, making all future interactions with it fail with the given error `e`.
|
||||
*/
|
||||
error(e?: any): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A default reader vended by a {@link ReadableStream}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class ReadableStreamDefaultReader<R = any> {
|
||||
constructor(stream: ReadableStream<R>);
|
||||
/**
|
||||
* Returns a promise that will be fulfilled when the stream becomes closed,
|
||||
* or rejected if the stream ever errors or the reader's lock is released before the stream finishes closing.
|
||||
*/
|
||||
readonly closed: Promise<undefined>;
|
||||
/**
|
||||
* If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.
|
||||
*/
|
||||
cancel(reason?: any): Promise<void>;
|
||||
/**
|
||||
* Returns a promise that allows access to the next chunk from the stream's internal queue, if available.
|
||||
*
|
||||
* If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.
|
||||
*/
|
||||
read(): Promise<ReadableStreamDefaultReadResult<R>>;
|
||||
/**
|
||||
* Releases the reader's lock on the corresponding stream. After the lock is released, the reader is no longer active.
|
||||
* If the associated stream is errored when the lock is released, the reader will appear errored in the same way
|
||||
* from now on; otherwise, the reader will appear closed.
|
||||
*
|
||||
* A reader's lock cannot be released while it still has a pending read request, i.e., if a promise returned by
|
||||
* the reader's {@link ReadableStreamDefaultReader.read | read()} method has not yet been settled. Attempting to
|
||||
* do so will throw a `TypeError` and leave the reader locked to the stream.
|
||||
*/
|
||||
releaseLock(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A result returned by {@link ReadableStreamDefaultReader.read}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare type ReadableStreamDefaultReadResult<T> = {
|
||||
done: false;
|
||||
value: T;
|
||||
} | {
|
||||
done: true;
|
||||
value?: undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Options for {@link ReadableStream.values | async iterating} a stream.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface ReadableStreamIteratorOptions {
|
||||
preventCancel?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A pair of a {@link ReadableStream | readable stream} and {@link WritableStream | writable stream} that can be passed
|
||||
* to {@link ReadableStream.pipeThrough}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface ReadableWritablePair<R, W> {
|
||||
readable: ReadableStream<R>;
|
||||
writable: WritableStream<W>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for {@link ReadableStream.pipeTo | piping} a stream.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface StreamPipeOptions {
|
||||
/**
|
||||
* If set to true, {@link ReadableStream.pipeTo} will not abort the writable stream if the readable stream errors.
|
||||
*/
|
||||
preventAbort?: boolean;
|
||||
/**
|
||||
* If set to true, {@link ReadableStream.pipeTo} will not cancel the readable stream if the writable stream closes
|
||||
* or errors.
|
||||
*/
|
||||
preventCancel?: boolean;
|
||||
/**
|
||||
* If set to true, {@link ReadableStream.pipeTo} will not close the writable stream if the readable stream closes.
|
||||
*/
|
||||
preventClose?: boolean;
|
||||
/**
|
||||
* Can be set to an {@link AbortSignal} to allow aborting an ongoing pipe operation via the corresponding
|
||||
* `AbortController`. In this case, the source readable stream will be canceled, and the destination writable stream
|
||||
* aborted, unless the respective options `preventCancel` or `preventAbort` are set.
|
||||
*/
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
|
||||
/**
|
||||
* A transformer for constructing a {@link TransformStream}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface Transformer<I = any, O = any> {
|
||||
/**
|
||||
* A function that is called immediately during creation of the {@link TransformStream}.
|
||||
*/
|
||||
start?: TransformerStartCallback<O>;
|
||||
/**
|
||||
* A function called when a new chunk originally written to the writable side is ready to be transformed.
|
||||
*/
|
||||
transform?: TransformerTransformCallback<I, O>;
|
||||
/**
|
||||
* A function called after all chunks written to the writable side have been transformed by successfully passing
|
||||
* through {@link Transformer.transform | transform()}, and the writable side is about to be closed.
|
||||
*/
|
||||
flush?: TransformerFlushCallback<O>;
|
||||
readableType?: undefined;
|
||||
writableType?: undefined;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export declare type TransformerFlushCallback<O> = (controller: TransformStreamDefaultController<O>) => void | PromiseLike<void>;
|
||||
|
||||
/** @public */
|
||||
export declare type TransformerStartCallback<O> = (controller: TransformStreamDefaultController<O>) => void | PromiseLike<void>;
|
||||
|
||||
/** @public */
|
||||
export declare type TransformerTransformCallback<I, O> = (chunk: I, controller: TransformStreamDefaultController<O>) => void | PromiseLike<void>;
|
||||
|
||||
/**
|
||||
* A transform stream consists of a pair of streams: a {@link WritableStream | writable stream},
|
||||
* known as its writable side, and a {@link ReadableStream | readable stream}, known as its readable side.
|
||||
* In a manner specific to the transform stream in question, writes to the writable side result in new data being
|
||||
* made available for reading from the readable side.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class TransformStream<I = any, O = any> {
|
||||
constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);
|
||||
/**
|
||||
* The readable side of the transform stream.
|
||||
*/
|
||||
readonly readable: ReadableStream<O>;
|
||||
/**
|
||||
* The writable side of the transform stream.
|
||||
*/
|
||||
readonly writable: WritableStream<I>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows control of the {@link ReadableStream} and {@link WritableStream} of the associated {@link TransformStream}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class TransformStreamDefaultController<O> {
|
||||
private constructor();
|
||||
/**
|
||||
* Returns the desired size to fill the readable side’s internal queue. It can be negative, if the queue is over-full.
|
||||
*/
|
||||
readonly desiredSize: number | null;
|
||||
/**
|
||||
* Enqueues the given chunk `chunk` in the readable side of the controlled transform stream.
|
||||
*/
|
||||
enqueue(chunk: O): void;
|
||||
/**
|
||||
* Errors both the readable side and the writable side of the controlled transform stream, making all future
|
||||
* interactions with it fail with the given error `e`. Any chunks queued for transformation will be discarded.
|
||||
*/
|
||||
error(reason?: any): void;
|
||||
/**
|
||||
* Closes the readable side and errors the writable side of the controlled transform stream. This is useful when the
|
||||
* transformer only needs to consume a portion of the chunks written to the writable side.
|
||||
*/
|
||||
terminate(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* An underlying byte source for constructing a {@link ReadableStream}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface UnderlyingByteSource {
|
||||
/**
|
||||
* {@inheritDoc UnderlyingSource.start}
|
||||
*/
|
||||
start?: UnderlyingByteSourceStartCallback;
|
||||
/**
|
||||
* {@inheritDoc UnderlyingSource.pull}
|
||||
*/
|
||||
pull?: UnderlyingByteSourcePullCallback;
|
||||
/**
|
||||
* {@inheritDoc UnderlyingSource.cancel}
|
||||
*/
|
||||
cancel?: UnderlyingSourceCancelCallback;
|
||||
/**
|
||||
* Can be set to "bytes" to signal that the constructed {@link ReadableStream} is a readable byte stream.
|
||||
* This ensures that the resulting {@link ReadableStream} will successfully be able to vend BYOB readers via its
|
||||
* {@link ReadableStream.(getReader:1) | getReader()} method.
|
||||
* It also affects the controller argument passed to the {@link UnderlyingByteSource.start | start()}
|
||||
* and {@link UnderlyingByteSource.pull | pull()} methods.
|
||||
*/
|
||||
type: 'bytes';
|
||||
/**
|
||||
* Can be set to a positive integer to cause the implementation to automatically allocate buffers for the
|
||||
* underlying source code to write into. In this case, when a consumer is using a default reader, the stream
|
||||
* implementation will automatically allocate an ArrayBuffer of the given size, so that
|
||||
* {@link ReadableByteStreamController.byobRequest | controller.byobRequest} is always present,
|
||||
* as if the consumer was using a BYOB reader.
|
||||
*/
|
||||
autoAllocateChunkSize?: number;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export declare type UnderlyingByteSourcePullCallback = (controller: ReadableByteStreamController) => void | PromiseLike<void>;
|
||||
|
||||
/** @public */
|
||||
export declare type UnderlyingByteSourceStartCallback = (controller: ReadableByteStreamController) => void | PromiseLike<void>;
|
||||
|
||||
/**
|
||||
* An underlying sink for constructing a {@link WritableStream}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface UnderlyingSink<W = any> {
|
||||
/**
|
||||
* A function that is called immediately during creation of the {@link WritableStream}.
|
||||
*/
|
||||
start?: UnderlyingSinkStartCallback;
|
||||
/**
|
||||
* A function that is called when a new chunk of data is ready to be written to the underlying sink. The stream
|
||||
* implementation guarantees that this function will be called only after previous writes have succeeded, and never
|
||||
* before {@link UnderlyingSink.start | start()} has succeeded or after {@link UnderlyingSink.close | close()} or
|
||||
* {@link UnderlyingSink.abort | abort()} have been called.
|
||||
*
|
||||
* This function is used to actually send the data to the resource presented by the underlying sink, for example by
|
||||
* calling a lower-level API.
|
||||
*/
|
||||
write?: UnderlyingSinkWriteCallback<W>;
|
||||
/**
|
||||
* A function that is called after the producer signals, via
|
||||
* {@link WritableStreamDefaultWriter.close | writer.close()}, that they are done writing chunks to the stream, and
|
||||
* subsequently all queued-up writes have successfully completed.
|
||||
*
|
||||
* This function can perform any actions necessary to finalize or flush writes to the underlying sink, and release
|
||||
* access to any held resources.
|
||||
*/
|
||||
close?: UnderlyingSinkCloseCallback;
|
||||
/**
|
||||
* A function that is called after the producer signals, via {@link WritableStream.abort | stream.abort()} or
|
||||
* {@link WritableStreamDefaultWriter.abort | writer.abort()}, that they wish to abort the stream. It takes as its
|
||||
* argument the same value as was passed to those methods by the producer.
|
||||
*
|
||||
* Writable streams can additionally be aborted under certain conditions during piping; see the definition of the
|
||||
* {@link ReadableStream.pipeTo | pipeTo()} method for more details.
|
||||
*
|
||||
* This function can clean up any held resources, much like {@link UnderlyingSink.close | close()}, but perhaps with
|
||||
* some custom handling.
|
||||
*/
|
||||
abort?: UnderlyingSinkAbortCallback;
|
||||
type?: undefined;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export declare type UnderlyingSinkAbortCallback = (reason: any) => void | PromiseLike<void>;
|
||||
|
||||
/** @public */
|
||||
export declare type UnderlyingSinkCloseCallback = () => void | PromiseLike<void>;
|
||||
|
||||
/** @public */
|
||||
export declare type UnderlyingSinkStartCallback = (controller: WritableStreamDefaultController) => void | PromiseLike<void>;
|
||||
|
||||
/** @public */
|
||||
export declare type UnderlyingSinkWriteCallback<W> = (chunk: W, controller: WritableStreamDefaultController) => void | PromiseLike<void>;
|
||||
|
||||
/**
|
||||
* An underlying source for constructing a {@link ReadableStream}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface UnderlyingSource<R = any> {
|
||||
/**
|
||||
* A function that is called immediately during creation of the {@link ReadableStream}.
|
||||
*/
|
||||
start?: UnderlyingSourceStartCallback<R>;
|
||||
/**
|
||||
* A function that is called whenever the stream’s internal queue of chunks becomes not full,
|
||||
* i.e. whenever the queue’s desired size becomes positive. Generally, it will be called repeatedly
|
||||
* until the queue reaches its high water mark (i.e. until the desired size becomes non-positive).
|
||||
*/
|
||||
pull?: UnderlyingSourcePullCallback<R>;
|
||||
/**
|
||||
* A function that is called whenever the consumer cancels the stream, via
|
||||
* {@link ReadableStream.cancel | stream.cancel()},
|
||||
* {@link ReadableStreamDefaultReader.cancel | defaultReader.cancel()}, or
|
||||
* {@link ReadableStreamBYOBReader.cancel | byobReader.cancel()}.
|
||||
* It takes as its argument the same value as was passed to those methods by the consumer.
|
||||
*/
|
||||
cancel?: UnderlyingSourceCancelCallback;
|
||||
type?: undefined;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export declare type UnderlyingSourceCancelCallback = (reason: any) => void | PromiseLike<void>;
|
||||
|
||||
/** @public */
|
||||
export declare type UnderlyingSourcePullCallback<R> = (controller: ReadableStreamDefaultController<R>) => void | PromiseLike<void>;
|
||||
|
||||
/** @public */
|
||||
export declare type UnderlyingSourceStartCallback<R> = (controller: ReadableStreamDefaultController<R>) => void | PromiseLike<void>;
|
||||
|
||||
/**
|
||||
* A writable stream represents a destination for data, into which you can write.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class WritableStream<W = any> {
|
||||
constructor(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>);
|
||||
/**
|
||||
* Returns whether or not the writable stream is locked to a writer.
|
||||
*/
|
||||
readonly locked: boolean;
|
||||
/**
|
||||
* Aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be
|
||||
* immediately moved to an errored state, with any queued-up writes discarded. This will also execute any abort
|
||||
* mechanism of the underlying sink.
|
||||
*
|
||||
* The returned promise will fulfill if the stream shuts down successfully, or reject if the underlying sink signaled
|
||||
* that there was an error doing so. Additionally, it will reject with a `TypeError` (without attempting to cancel
|
||||
* the stream) if the stream is currently locked.
|
||||
*/
|
||||
abort(reason?: any): Promise<void>;
|
||||
/**
|
||||
* Closes the stream. The underlying sink will finish processing any previously-written chunks, before invoking its
|
||||
* close behavior. During this time any further attempts to write will fail (without erroring the stream).
|
||||
*
|
||||
* The method returns a promise that will fulfill if all remaining chunks are successfully written and the stream
|
||||
* successfully closes, or rejects if an error is encountered during this process. Additionally, it will reject with
|
||||
* a `TypeError` (without attempting to cancel the stream) if the stream is currently locked.
|
||||
*/
|
||||
close(): Promise<undefined>;
|
||||
/**
|
||||
* Creates a {@link WritableStreamDefaultWriter | writer} and locks the stream to the new writer. While the stream
|
||||
* is locked, no other writer can be acquired until this one is released.
|
||||
*
|
||||
* This functionality is especially useful for creating abstractions that desire the ability to write to a stream
|
||||
* without interruption or interleaving. By getting a writer for the stream, you can ensure nobody else can write at
|
||||
* the same time, which would cause the resulting written data to be unpredictable and probably useless.
|
||||
*/
|
||||
getWriter(): WritableStreamDefaultWriter<W>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows control of a {@link WritableStream | writable stream}'s state and internal queue.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class WritableStreamDefaultController<W = any> {
|
||||
private constructor();
|
||||
/**
|
||||
* The reason which was passed to `WritableStream.abort(reason)` when the stream was aborted.
|
||||
*
|
||||
* @deprecated
|
||||
* This property has been removed from the specification, see https://github.com/whatwg/streams/pull/1177.
|
||||
* Use {@link WritableStreamDefaultController.signal}'s `reason` instead.
|
||||
*/
|
||||
readonly abortReason: any;
|
||||
/**
|
||||
* An `AbortSignal` that can be used to abort the pending write or close operation when the stream is aborted.
|
||||
*/
|
||||
readonly signal: AbortSignal;
|
||||
/**
|
||||
* Closes the controlled writable stream, making all future interactions with it fail with the given error `e`.
|
||||
*
|
||||
* This method is rarely used, since usually it suffices to return a rejected promise from one of the underlying
|
||||
* sink's methods. However, it can be useful for suddenly shutting down a stream in response to an event outside the
|
||||
* normal lifecycle of interactions with the underlying sink.
|
||||
*/
|
||||
error(e?: any): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A default writer vended by a {@link WritableStream}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class WritableStreamDefaultWriter<W = any> {
|
||||
constructor(stream: WritableStream<W>);
|
||||
/**
|
||||
* Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or
|
||||
* the writer’s lock is released before the stream finishes closing.
|
||||
*/
|
||||
readonly closed: Promise<undefined>;
|
||||
/**
|
||||
* Returns the desired size to fill the stream’s internal queue. It can be negative, if the queue is over-full.
|
||||
* A producer can use this information to determine the right amount of data to write.
|
||||
*
|
||||
* It will be `null` if the stream cannot be successfully written to (due to either being errored, or having an abort
|
||||
* queued up). It will return zero if the stream is closed. And the getter will throw an exception if invoked when
|
||||
* the writer’s lock is released.
|
||||
*/
|
||||
readonly desiredSize: number | null;
|
||||
/**
|
||||
* Returns a promise that will be fulfilled when the desired size to fill the stream’s internal queue transitions
|
||||
* from non-positive to positive, signaling that it is no longer applying backpressure. Once the desired size dips
|
||||
* back to zero or below, the getter will return a new promise that stays pending until the next transition.
|
||||
*
|
||||
* If the stream becomes errored or aborted, or the writer’s lock is released, the returned promise will become
|
||||
* rejected.
|
||||
*/
|
||||
readonly ready: Promise<undefined>;
|
||||
/**
|
||||
* If the reader is active, behaves the same as {@link WritableStream.abort | stream.abort(reason)}.
|
||||
*/
|
||||
abort(reason?: any): Promise<void>;
|
||||
/**
|
||||
* If the reader is active, behaves the same as {@link WritableStream.close | stream.close()}.
|
||||
*/
|
||||
close(): Promise<void>;
|
||||
/**
|
||||
* Releases the writer’s lock on the corresponding stream. After the lock is released, the writer is no longer active.
|
||||
* If the associated stream is errored when the lock is released, the writer will appear errored in the same way from
|
||||
* now on; otherwise, the writer will appear closed.
|
||||
*
|
||||
* Note that the lock can still be released even if some ongoing writes have not yet finished (i.e. even if the
|
||||
* promises returned from previous calls to {@link WritableStreamDefaultWriter.write | write()} have not yet settled).
|
||||
* It’s not necessary to hold the lock on the writer for the duration of the write; the lock instead simply prevents
|
||||
* other producers from writing in an interleaved manner.
|
||||
*/
|
||||
releaseLock(): void;
|
||||
/**
|
||||
* Writes the given chunk to the writable stream, by waiting until any previous writes have finished successfully,
|
||||
* and then sending the chunk to the underlying sink's {@link UnderlyingSink.write | write()} method. It will return
|
||||
* a promise that fulfills with undefined upon a successful write, or rejects if the write fails or stream becomes
|
||||
* errored before the writing process is initiated.
|
||||
*
|
||||
* Note that what "success" means is up to the underlying sink; it might indicate simply that the chunk has been
|
||||
* accepted, and not necessarily that it is safely saved to its ultimate destination.
|
||||
*/
|
||||
write(chunk: W): Promise<void>;
|
||||
}
|
||||
|
||||
export { }
|
||||
Generated
Vendored
+771
@@ -0,0 +1,771 @@
|
||||
/// <reference lib="es2018.asynciterable" />
|
||||
|
||||
/**
|
||||
* A signal object that allows you to communicate with a request and abort it if required
|
||||
* via its associated `AbortController` object.
|
||||
*
|
||||
* @remarks
|
||||
* This interface is compatible with the `AbortSignal` interface defined in TypeScript's DOM types.
|
||||
* It is redefined here, so it can be polyfilled without a DOM, for example with
|
||||
* {@link https://www.npmjs.com/package/abortcontroller-polyfill | abortcontroller-polyfill} in a Node environment.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface AbortSignal {
|
||||
/**
|
||||
* Whether the request is aborted.
|
||||
*/
|
||||
readonly aborted: boolean;
|
||||
/**
|
||||
* Add an event listener to be triggered when this signal becomes aborted.
|
||||
*/
|
||||
addEventListener(type: 'abort', listener: () => void): void;
|
||||
/**
|
||||
* Remove an event listener that was previously added with {@link AbortSignal.addEventListener}.
|
||||
*/
|
||||
removeEventListener(type: 'abort', listener: () => void): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A queuing strategy that counts the number of bytes in each chunk.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class ByteLengthQueuingStrategy implements QueuingStrategy<ArrayBufferView> {
|
||||
constructor(options: QueuingStrategyInit);
|
||||
/**
|
||||
* Returns the high water mark provided to the constructor.
|
||||
*/
|
||||
get highWaterMark(): number;
|
||||
/**
|
||||
* Measures the size of `chunk` by returning the value of its `byteLength` property.
|
||||
*/
|
||||
get size(): (chunk: ArrayBufferView) => number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A queuing strategy that counts the number of chunks.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class CountQueuingStrategy implements QueuingStrategy<any> {
|
||||
constructor(options: QueuingStrategyInit);
|
||||
/**
|
||||
* Returns the high water mark provided to the constructor.
|
||||
*/
|
||||
get highWaterMark(): number;
|
||||
/**
|
||||
* Measures the size of `chunk` by always returning 1.
|
||||
* This ensures that the total queue size is a count of the number of chunks in the queue.
|
||||
*/
|
||||
get size(): (chunk: any) => 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* A queuing strategy.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface QueuingStrategy<T = any> {
|
||||
/**
|
||||
* A non-negative number indicating the high water mark of the stream using this queuing strategy.
|
||||
*/
|
||||
highWaterMark?: number;
|
||||
/**
|
||||
* A function that computes and returns the finite non-negative size of the given chunk value.
|
||||
*/
|
||||
size?: QueuingStrategySizeCallback<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare interface QueuingStrategyInit {
|
||||
/**
|
||||
* {@inheritDoc QueuingStrategy.highWaterMark}
|
||||
*/
|
||||
highWaterMark: number;
|
||||
}
|
||||
|
||||
declare type QueuingStrategySizeCallback<T = any> = (chunk: T) => number;
|
||||
|
||||
declare type ReadableByteStream = ReadableStream<Uint8Array> & {
|
||||
_readableStreamController: ReadableByteStreamController;
|
||||
};
|
||||
|
||||
/**
|
||||
* Allows control of a {@link ReadableStream | readable byte stream}'s state and internal queue.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class ReadableByteStreamController {
|
||||
private constructor();
|
||||
/**
|
||||
* Returns the current BYOB pull request, or `null` if there isn't one.
|
||||
*/
|
||||
get byobRequest(): ReadableStreamBYOBRequest | null;
|
||||
/**
|
||||
* Returns the desired size to fill the controlled stream's internal queue. It can be negative, if the queue is
|
||||
* over-full. An underlying byte source ought to use this information to determine when and how to apply backpressure.
|
||||
*/
|
||||
get desiredSize(): number | null;
|
||||
/**
|
||||
* Closes the controlled readable stream. Consumers will still be able to read any previously-enqueued chunks from
|
||||
* the stream, but once those are read, the stream will become closed.
|
||||
*/
|
||||
close(): void;
|
||||
/**
|
||||
* Enqueues the given chunk chunk in the controlled readable stream.
|
||||
* The chunk has to be an `ArrayBufferView` instance, or else a `TypeError` will be thrown.
|
||||
*/
|
||||
enqueue(chunk: ArrayBufferView): void;
|
||||
/**
|
||||
* Errors the controlled readable stream, making all future interactions with it fail with the given error `e`.
|
||||
*/
|
||||
error(e?: any): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A readable stream represents a source of data, from which you can read.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class ReadableStream<R = any> {
|
||||
constructor(underlyingSource: UnderlyingByteSource, strategy?: {
|
||||
highWaterMark?: number;
|
||||
size?: undefined;
|
||||
});
|
||||
constructor(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>);
|
||||
/**
|
||||
* Whether or not the readable stream is locked to a {@link ReadableStreamDefaultReader | reader}.
|
||||
*/
|
||||
get locked(): boolean;
|
||||
/**
|
||||
* Cancels the stream, signaling a loss of interest in the stream by a consumer.
|
||||
*
|
||||
* The supplied `reason` argument will be given to the underlying source's {@link UnderlyingSource.cancel | cancel()}
|
||||
* method, which might or might not use it.
|
||||
*/
|
||||
cancel(reason?: any): Promise<void>;
|
||||
/**
|
||||
* Creates a {@link ReadableStreamBYOBReader} and locks the stream to the new reader.
|
||||
*
|
||||
* This call behaves the same way as the no-argument variant, except that it only works on readable byte streams,
|
||||
* i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading.
|
||||
* The returned BYOB reader provides the ability to directly read individual chunks from the stream via its
|
||||
* {@link ReadableStreamBYOBReader.read | read()} method, into developer-supplied buffers, allowing more precise
|
||||
* control over allocation.
|
||||
*/
|
||||
getReader({ mode }: {
|
||||
mode: 'byob';
|
||||
}): ReadableStreamBYOBReader;
|
||||
/**
|
||||
* Creates a {@link ReadableStreamDefaultReader} and locks the stream to the new reader.
|
||||
* While the stream is locked, no other reader can be acquired until this one is released.
|
||||
*
|
||||
* This functionality is especially useful for creating abstractions that desire the ability to consume a stream
|
||||
* in its entirety. By getting a reader for the stream, you can ensure nobody else can interleave reads with yours
|
||||
* or cancel the stream, which would interfere with your abstraction.
|
||||
*/
|
||||
getReader(): ReadableStreamDefaultReader<R>;
|
||||
/**
|
||||
* Provides a convenient, chainable way of piping this readable stream through a transform stream
|
||||
* (or any other `{ writable, readable }` pair). It simply {@link ReadableStream.pipeTo | pipes} the stream
|
||||
* into the writable side of the supplied pair, and returns the readable side for further use.
|
||||
*
|
||||
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
|
||||
*/
|
||||
pipeThrough<RS extends ReadableStream>(transform: {
|
||||
readable: RS;
|
||||
writable: WritableStream<R>;
|
||||
}, options?: StreamPipeOptions): RS;
|
||||
/**
|
||||
* Pipes this readable stream to a given writable stream. The way in which the piping process behaves under
|
||||
* various error conditions can be customized with a number of passed options. It returns a promise that fulfills
|
||||
* when the piping process completes successfully, or rejects if any errors were encountered.
|
||||
*
|
||||
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
|
||||
*/
|
||||
pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
|
||||
/**
|
||||
* Tees this readable stream, returning a two-element array containing the two resulting branches as
|
||||
* new {@link ReadableStream} instances.
|
||||
*
|
||||
* Teeing a stream will lock it, preventing any other consumer from acquiring a reader.
|
||||
* To cancel the stream, cancel both of the resulting branches; a composite cancellation reason will then be
|
||||
* propagated to the stream's underlying source.
|
||||
*
|
||||
* Note that the chunks seen in each branch will be the same object. If the chunks are not immutable,
|
||||
* this could allow interference between the two branches.
|
||||
*/
|
||||
tee(): [ReadableStream<R>, ReadableStream<R>];
|
||||
/**
|
||||
* Asynchronously iterates over the chunks in the stream's internal queue.
|
||||
*
|
||||
* Asynchronously iterating over the stream will lock it, preventing any other consumer from acquiring a reader.
|
||||
* The lock will be released if the async iterator's {@link ReadableStreamAsyncIterator.return | return()} method
|
||||
* is called, e.g. by breaking out of the loop.
|
||||
*
|
||||
* By default, calling the async iterator's {@link ReadableStreamAsyncIterator.return | return()} method will also
|
||||
* cancel the stream. To prevent this, use the stream's {@link ReadableStream.values | values()} method, passing
|
||||
* `true` for the `preventCancel` option.
|
||||
*/
|
||||
values(options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator<R>;
|
||||
/**
|
||||
* {@inheritDoc ReadableStream.values}
|
||||
*/
|
||||
[Symbol.asyncIterator]: (options?: ReadableStreamIteratorOptions) => ReadableStreamAsyncIterator<R>;
|
||||
}
|
||||
|
||||
/**
|
||||
* An async iterator returned by {@link ReadableStream.values}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface ReadableStreamAsyncIterator<R> extends AsyncIterator<R> {
|
||||
next(): Promise<IteratorResult<R, undefined>>;
|
||||
return(value?: any): Promise<IteratorResult<any>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A BYOB reader vended by a {@link ReadableStream}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class ReadableStreamBYOBReader {
|
||||
constructor(stream: ReadableByteStream);
|
||||
/**
|
||||
* Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or
|
||||
* the reader's lock is released before the stream finishes closing.
|
||||
*/
|
||||
get closed(): Promise<undefined>;
|
||||
/**
|
||||
* If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.
|
||||
*/
|
||||
cancel(reason?: any): Promise<void>;
|
||||
/**
|
||||
* Attempts to reads bytes into view, and returns a promise resolved with the result.
|
||||
*
|
||||
* If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.
|
||||
*/
|
||||
read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamBYOBReadResult<T>>;
|
||||
/**
|
||||
* Releases the reader's lock on the corresponding stream. After the lock is released, the reader is no longer active.
|
||||
* If the associated stream is errored when the lock is released, the reader will appear errored in the same way
|
||||
* from now on; otherwise, the reader will appear closed.
|
||||
*
|
||||
* A reader's lock cannot be released while it still has a pending read request, i.e., if a promise returned by
|
||||
* the reader's {@link ReadableStreamBYOBReader.read | read()} method has not yet been settled. Attempting to
|
||||
* do so will throw a `TypeError` and leave the reader locked to the stream.
|
||||
*/
|
||||
releaseLock(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A result returned by {@link ReadableStreamBYOBReader.read}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare type ReadableStreamBYOBReadResult<T extends ArrayBufferView> = {
|
||||
done: false;
|
||||
value: T;
|
||||
} | {
|
||||
done: true;
|
||||
value: T | undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* A pull-into request in a {@link ReadableByteStreamController}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class ReadableStreamBYOBRequest {
|
||||
private constructor();
|
||||
/**
|
||||
* Returns the view for writing in to, or `null` if the BYOB request has already been responded to.
|
||||
*/
|
||||
get view(): ArrayBufferView | null;
|
||||
/**
|
||||
* Indicates to the associated readable byte stream that `bytesWritten` bytes were written into
|
||||
* {@link ReadableStreamBYOBRequest.view | view}, causing the result be surfaced to the consumer.
|
||||
*
|
||||
* After this method is called, {@link ReadableStreamBYOBRequest.view | view} will be transferred and no longer
|
||||
* modifiable.
|
||||
*/
|
||||
respond(bytesWritten: number): void;
|
||||
/**
|
||||
* Indicates to the associated readable byte stream that instead of writing into
|
||||
* {@link ReadableStreamBYOBRequest.view | view}, the underlying byte source is providing a new `ArrayBufferView`,
|
||||
* which will be given to the consumer of the readable byte stream.
|
||||
*
|
||||
* After this method is called, `view` will be transferred and no longer modifiable.
|
||||
*/
|
||||
respondWithNewView(view: ArrayBufferView): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows control of a {@link ReadableStream | readable stream}'s state and internal queue.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class ReadableStreamDefaultController<R> {
|
||||
private constructor();
|
||||
/**
|
||||
* Returns the desired size to fill the controlled stream's internal queue. It can be negative, if the queue is
|
||||
* over-full. An underlying source ought to use this information to determine when and how to apply backpressure.
|
||||
*/
|
||||
get desiredSize(): number | null;
|
||||
/**
|
||||
* Closes the controlled readable stream. Consumers will still be able to read any previously-enqueued chunks from
|
||||
* the stream, but once those are read, the stream will become closed.
|
||||
*/
|
||||
close(): void;
|
||||
/**
|
||||
* Enqueues the given chunk `chunk` in the controlled readable stream.
|
||||
*/
|
||||
enqueue(chunk: R): void;
|
||||
/**
|
||||
* Errors the controlled readable stream, making all future interactions with it fail with the given error `e`.
|
||||
*/
|
||||
error(e?: any): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A default reader vended by a {@link ReadableStream}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class ReadableStreamDefaultReader<R = any> {
|
||||
constructor(stream: ReadableStream<R>);
|
||||
/**
|
||||
* Returns a promise that will be fulfilled when the stream becomes closed,
|
||||
* or rejected if the stream ever errors or the reader's lock is released before the stream finishes closing.
|
||||
*/
|
||||
get closed(): Promise<undefined>;
|
||||
/**
|
||||
* If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.
|
||||
*/
|
||||
cancel(reason?: any): Promise<void>;
|
||||
/**
|
||||
* Returns a promise that allows access to the next chunk from the stream's internal queue, if available.
|
||||
*
|
||||
* If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.
|
||||
*/
|
||||
read(): Promise<ReadableStreamDefaultReadResult<R>>;
|
||||
/**
|
||||
* Releases the reader's lock on the corresponding stream. After the lock is released, the reader is no longer active.
|
||||
* If the associated stream is errored when the lock is released, the reader will appear errored in the same way
|
||||
* from now on; otherwise, the reader will appear closed.
|
||||
*
|
||||
* A reader's lock cannot be released while it still has a pending read request, i.e., if a promise returned by
|
||||
* the reader's {@link ReadableStreamDefaultReader.read | read()} method has not yet been settled. Attempting to
|
||||
* do so will throw a `TypeError` and leave the reader locked to the stream.
|
||||
*/
|
||||
releaseLock(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A result returned by {@link ReadableStreamDefaultReader.read}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare type ReadableStreamDefaultReadResult<T> = {
|
||||
done: false;
|
||||
value: T;
|
||||
} | {
|
||||
done: true;
|
||||
value?: undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Options for {@link ReadableStream.values | async iterating} a stream.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface ReadableStreamIteratorOptions {
|
||||
preventCancel?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A pair of a {@link ReadableStream | readable stream} and {@link WritableStream | writable stream} that can be passed
|
||||
* to {@link ReadableStream.pipeThrough}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface ReadableWritablePair<R, W> {
|
||||
readable: ReadableStream<R>;
|
||||
writable: WritableStream<W>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for {@link ReadableStream.pipeTo | piping} a stream.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface StreamPipeOptions {
|
||||
/**
|
||||
* If set to true, {@link ReadableStream.pipeTo} will not abort the writable stream if the readable stream errors.
|
||||
*/
|
||||
preventAbort?: boolean;
|
||||
/**
|
||||
* If set to true, {@link ReadableStream.pipeTo} will not cancel the readable stream if the writable stream closes
|
||||
* or errors.
|
||||
*/
|
||||
preventCancel?: boolean;
|
||||
/**
|
||||
* If set to true, {@link ReadableStream.pipeTo} will not close the writable stream if the readable stream closes.
|
||||
*/
|
||||
preventClose?: boolean;
|
||||
/**
|
||||
* Can be set to an {@link AbortSignal} to allow aborting an ongoing pipe operation via the corresponding
|
||||
* `AbortController`. In this case, the source readable stream will be canceled, and the destination writable stream
|
||||
* aborted, unless the respective options `preventCancel` or `preventAbort` are set.
|
||||
*/
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
|
||||
/**
|
||||
* A transformer for constructing a {@link TransformStream}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface Transformer<I = any, O = any> {
|
||||
/**
|
||||
* A function that is called immediately during creation of the {@link TransformStream}.
|
||||
*/
|
||||
start?: TransformerStartCallback<O>;
|
||||
/**
|
||||
* A function called when a new chunk originally written to the writable side is ready to be transformed.
|
||||
*/
|
||||
transform?: TransformerTransformCallback<I, O>;
|
||||
/**
|
||||
* A function called after all chunks written to the writable side have been transformed by successfully passing
|
||||
* through {@link Transformer.transform | transform()}, and the writable side is about to be closed.
|
||||
*/
|
||||
flush?: TransformerFlushCallback<O>;
|
||||
readableType?: undefined;
|
||||
writableType?: undefined;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export declare type TransformerFlushCallback<O> = (controller: TransformStreamDefaultController<O>) => void | PromiseLike<void>;
|
||||
|
||||
/** @public */
|
||||
export declare type TransformerStartCallback<O> = (controller: TransformStreamDefaultController<O>) => void | PromiseLike<void>;
|
||||
|
||||
/** @public */
|
||||
export declare type TransformerTransformCallback<I, O> = (chunk: I, controller: TransformStreamDefaultController<O>) => void | PromiseLike<void>;
|
||||
|
||||
/**
|
||||
* A transform stream consists of a pair of streams: a {@link WritableStream | writable stream},
|
||||
* known as its writable side, and a {@link ReadableStream | readable stream}, known as its readable side.
|
||||
* In a manner specific to the transform stream in question, writes to the writable side result in new data being
|
||||
* made available for reading from the readable side.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class TransformStream<I = any, O = any> {
|
||||
constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);
|
||||
/**
|
||||
* The readable side of the transform stream.
|
||||
*/
|
||||
get readable(): ReadableStream<O>;
|
||||
/**
|
||||
* The writable side of the transform stream.
|
||||
*/
|
||||
get writable(): WritableStream<I>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows control of the {@link ReadableStream} and {@link WritableStream} of the associated {@link TransformStream}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class TransformStreamDefaultController<O> {
|
||||
private constructor();
|
||||
/**
|
||||
* Returns the desired size to fill the readable side’s internal queue. It can be negative, if the queue is over-full.
|
||||
*/
|
||||
get desiredSize(): number | null;
|
||||
/**
|
||||
* Enqueues the given chunk `chunk` in the readable side of the controlled transform stream.
|
||||
*/
|
||||
enqueue(chunk: O): void;
|
||||
/**
|
||||
* Errors both the readable side and the writable side of the controlled transform stream, making all future
|
||||
* interactions with it fail with the given error `e`. Any chunks queued for transformation will be discarded.
|
||||
*/
|
||||
error(reason?: any): void;
|
||||
/**
|
||||
* Closes the readable side and errors the writable side of the controlled transform stream. This is useful when the
|
||||
* transformer only needs to consume a portion of the chunks written to the writable side.
|
||||
*/
|
||||
terminate(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* An underlying byte source for constructing a {@link ReadableStream}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface UnderlyingByteSource {
|
||||
/**
|
||||
* {@inheritDoc UnderlyingSource.start}
|
||||
*/
|
||||
start?: UnderlyingByteSourceStartCallback;
|
||||
/**
|
||||
* {@inheritDoc UnderlyingSource.pull}
|
||||
*/
|
||||
pull?: UnderlyingByteSourcePullCallback;
|
||||
/**
|
||||
* {@inheritDoc UnderlyingSource.cancel}
|
||||
*/
|
||||
cancel?: UnderlyingSourceCancelCallback;
|
||||
/**
|
||||
* Can be set to "bytes" to signal that the constructed {@link ReadableStream} is a readable byte stream.
|
||||
* This ensures that the resulting {@link ReadableStream} will successfully be able to vend BYOB readers via its
|
||||
* {@link ReadableStream.(getReader:1) | getReader()} method.
|
||||
* It also affects the controller argument passed to the {@link UnderlyingByteSource.start | start()}
|
||||
* and {@link UnderlyingByteSource.pull | pull()} methods.
|
||||
*/
|
||||
type: 'bytes';
|
||||
/**
|
||||
* Can be set to a positive integer to cause the implementation to automatically allocate buffers for the
|
||||
* underlying source code to write into. In this case, when a consumer is using a default reader, the stream
|
||||
* implementation will automatically allocate an ArrayBuffer of the given size, so that
|
||||
* {@link ReadableByteStreamController.byobRequest | controller.byobRequest} is always present,
|
||||
* as if the consumer was using a BYOB reader.
|
||||
*/
|
||||
autoAllocateChunkSize?: number;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export declare type UnderlyingByteSourcePullCallback = (controller: ReadableByteStreamController) => void | PromiseLike<void>;
|
||||
|
||||
/** @public */
|
||||
export declare type UnderlyingByteSourceStartCallback = (controller: ReadableByteStreamController) => void | PromiseLike<void>;
|
||||
|
||||
/**
|
||||
* An underlying sink for constructing a {@link WritableStream}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface UnderlyingSink<W = any> {
|
||||
/**
|
||||
* A function that is called immediately during creation of the {@link WritableStream}.
|
||||
*/
|
||||
start?: UnderlyingSinkStartCallback;
|
||||
/**
|
||||
* A function that is called when a new chunk of data is ready to be written to the underlying sink. The stream
|
||||
* implementation guarantees that this function will be called only after previous writes have succeeded, and never
|
||||
* before {@link UnderlyingSink.start | start()} has succeeded or after {@link UnderlyingSink.close | close()} or
|
||||
* {@link UnderlyingSink.abort | abort()} have been called.
|
||||
*
|
||||
* This function is used to actually send the data to the resource presented by the underlying sink, for example by
|
||||
* calling a lower-level API.
|
||||
*/
|
||||
write?: UnderlyingSinkWriteCallback<W>;
|
||||
/**
|
||||
* A function that is called after the producer signals, via
|
||||
* {@link WritableStreamDefaultWriter.close | writer.close()}, that they are done writing chunks to the stream, and
|
||||
* subsequently all queued-up writes have successfully completed.
|
||||
*
|
||||
* This function can perform any actions necessary to finalize or flush writes to the underlying sink, and release
|
||||
* access to any held resources.
|
||||
*/
|
||||
close?: UnderlyingSinkCloseCallback;
|
||||
/**
|
||||
* A function that is called after the producer signals, via {@link WritableStream.abort | stream.abort()} or
|
||||
* {@link WritableStreamDefaultWriter.abort | writer.abort()}, that they wish to abort the stream. It takes as its
|
||||
* argument the same value as was passed to those methods by the producer.
|
||||
*
|
||||
* Writable streams can additionally be aborted under certain conditions during piping; see the definition of the
|
||||
* {@link ReadableStream.pipeTo | pipeTo()} method for more details.
|
||||
*
|
||||
* This function can clean up any held resources, much like {@link UnderlyingSink.close | close()}, but perhaps with
|
||||
* some custom handling.
|
||||
*/
|
||||
abort?: UnderlyingSinkAbortCallback;
|
||||
type?: undefined;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export declare type UnderlyingSinkAbortCallback = (reason: any) => void | PromiseLike<void>;
|
||||
|
||||
/** @public */
|
||||
export declare type UnderlyingSinkCloseCallback = () => void | PromiseLike<void>;
|
||||
|
||||
/** @public */
|
||||
export declare type UnderlyingSinkStartCallback = (controller: WritableStreamDefaultController) => void | PromiseLike<void>;
|
||||
|
||||
/** @public */
|
||||
export declare type UnderlyingSinkWriteCallback<W> = (chunk: W, controller: WritableStreamDefaultController) => void | PromiseLike<void>;
|
||||
|
||||
/**
|
||||
* An underlying source for constructing a {@link ReadableStream}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare interface UnderlyingSource<R = any> {
|
||||
/**
|
||||
* A function that is called immediately during creation of the {@link ReadableStream}.
|
||||
*/
|
||||
start?: UnderlyingSourceStartCallback<R>;
|
||||
/**
|
||||
* A function that is called whenever the stream’s internal queue of chunks becomes not full,
|
||||
* i.e. whenever the queue’s desired size becomes positive. Generally, it will be called repeatedly
|
||||
* until the queue reaches its high water mark (i.e. until the desired size becomes non-positive).
|
||||
*/
|
||||
pull?: UnderlyingSourcePullCallback<R>;
|
||||
/**
|
||||
* A function that is called whenever the consumer cancels the stream, via
|
||||
* {@link ReadableStream.cancel | stream.cancel()},
|
||||
* {@link ReadableStreamDefaultReader.cancel | defaultReader.cancel()}, or
|
||||
* {@link ReadableStreamBYOBReader.cancel | byobReader.cancel()}.
|
||||
* It takes as its argument the same value as was passed to those methods by the consumer.
|
||||
*/
|
||||
cancel?: UnderlyingSourceCancelCallback;
|
||||
type?: undefined;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export declare type UnderlyingSourceCancelCallback = (reason: any) => void | PromiseLike<void>;
|
||||
|
||||
/** @public */
|
||||
export declare type UnderlyingSourcePullCallback<R> = (controller: ReadableStreamDefaultController<R>) => void | PromiseLike<void>;
|
||||
|
||||
/** @public */
|
||||
export declare type UnderlyingSourceStartCallback<R> = (controller: ReadableStreamDefaultController<R>) => void | PromiseLike<void>;
|
||||
|
||||
/**
|
||||
* A writable stream represents a destination for data, into which you can write.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class WritableStream<W = any> {
|
||||
constructor(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>);
|
||||
/**
|
||||
* Returns whether or not the writable stream is locked to a writer.
|
||||
*/
|
||||
get locked(): boolean;
|
||||
/**
|
||||
* Aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be
|
||||
* immediately moved to an errored state, with any queued-up writes discarded. This will also execute any abort
|
||||
* mechanism of the underlying sink.
|
||||
*
|
||||
* The returned promise will fulfill if the stream shuts down successfully, or reject if the underlying sink signaled
|
||||
* that there was an error doing so. Additionally, it will reject with a `TypeError` (without attempting to cancel
|
||||
* the stream) if the stream is currently locked.
|
||||
*/
|
||||
abort(reason?: any): Promise<void>;
|
||||
/**
|
||||
* Closes the stream. The underlying sink will finish processing any previously-written chunks, before invoking its
|
||||
* close behavior. During this time any further attempts to write will fail (without erroring the stream).
|
||||
*
|
||||
* The method returns a promise that will fulfill if all remaining chunks are successfully written and the stream
|
||||
* successfully closes, or rejects if an error is encountered during this process. Additionally, it will reject with
|
||||
* a `TypeError` (without attempting to cancel the stream) if the stream is currently locked.
|
||||
*/
|
||||
close(): Promise<undefined>;
|
||||
/**
|
||||
* Creates a {@link WritableStreamDefaultWriter | writer} and locks the stream to the new writer. While the stream
|
||||
* is locked, no other writer can be acquired until this one is released.
|
||||
*
|
||||
* This functionality is especially useful for creating abstractions that desire the ability to write to a stream
|
||||
* without interruption or interleaving. By getting a writer for the stream, you can ensure nobody else can write at
|
||||
* the same time, which would cause the resulting written data to be unpredictable and probably useless.
|
||||
*/
|
||||
getWriter(): WritableStreamDefaultWriter<W>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows control of a {@link WritableStream | writable stream}'s state and internal queue.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class WritableStreamDefaultController<W = any> {
|
||||
private constructor();
|
||||
/**
|
||||
* The reason which was passed to `WritableStream.abort(reason)` when the stream was aborted.
|
||||
*
|
||||
* @deprecated
|
||||
* This property has been removed from the specification, see https://github.com/whatwg/streams/pull/1177.
|
||||
* Use {@link WritableStreamDefaultController.signal}'s `reason` instead.
|
||||
*/
|
||||
get abortReason(): any;
|
||||
/**
|
||||
* An `AbortSignal` that can be used to abort the pending write or close operation when the stream is aborted.
|
||||
*/
|
||||
get signal(): AbortSignal;
|
||||
/**
|
||||
* Closes the controlled writable stream, making all future interactions with it fail with the given error `e`.
|
||||
*
|
||||
* This method is rarely used, since usually it suffices to return a rejected promise from one of the underlying
|
||||
* sink's methods. However, it can be useful for suddenly shutting down a stream in response to an event outside the
|
||||
* normal lifecycle of interactions with the underlying sink.
|
||||
*/
|
||||
error(e?: any): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A default writer vended by a {@link WritableStream}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class WritableStreamDefaultWriter<W = any> {
|
||||
constructor(stream: WritableStream<W>);
|
||||
/**
|
||||
* Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or
|
||||
* the writer’s lock is released before the stream finishes closing.
|
||||
*/
|
||||
get closed(): Promise<undefined>;
|
||||
/**
|
||||
* Returns the desired size to fill the stream’s internal queue. It can be negative, if the queue is over-full.
|
||||
* A producer can use this information to determine the right amount of data to write.
|
||||
*
|
||||
* It will be `null` if the stream cannot be successfully written to (due to either being errored, or having an abort
|
||||
* queued up). It will return zero if the stream is closed. And the getter will throw an exception if invoked when
|
||||
* the writer’s lock is released.
|
||||
*/
|
||||
get desiredSize(): number | null;
|
||||
/**
|
||||
* Returns a promise that will be fulfilled when the desired size to fill the stream’s internal queue transitions
|
||||
* from non-positive to positive, signaling that it is no longer applying backpressure. Once the desired size dips
|
||||
* back to zero or below, the getter will return a new promise that stays pending until the next transition.
|
||||
*
|
||||
* If the stream becomes errored or aborted, or the writer’s lock is released, the returned promise will become
|
||||
* rejected.
|
||||
*/
|
||||
get ready(): Promise<undefined>;
|
||||
/**
|
||||
* If the reader is active, behaves the same as {@link WritableStream.abort | stream.abort(reason)}.
|
||||
*/
|
||||
abort(reason?: any): Promise<void>;
|
||||
/**
|
||||
* If the reader is active, behaves the same as {@link WritableStream.close | stream.close()}.
|
||||
*/
|
||||
close(): Promise<void>;
|
||||
/**
|
||||
* Releases the writer’s lock on the corresponding stream. After the lock is released, the writer is no longer active.
|
||||
* If the associated stream is errored when the lock is released, the writer will appear errored in the same way from
|
||||
* now on; otherwise, the writer will appear closed.
|
||||
*
|
||||
* Note that the lock can still be released even if some ongoing writes have not yet finished (i.e. even if the
|
||||
* promises returned from previous calls to {@link WritableStreamDefaultWriter.write | write()} have not yet settled).
|
||||
* It’s not necessary to hold the lock on the writer for the duration of the write; the lock instead simply prevents
|
||||
* other producers from writing in an interleaved manner.
|
||||
*/
|
||||
releaseLock(): void;
|
||||
/**
|
||||
* Writes the given chunk to the writable stream, by waiting until any previous writes have finished successfully,
|
||||
* and then sending the chunk to the underlying sink's {@link UnderlyingSink.write | write()} method. It will return
|
||||
* a promise that fulfills with undefined upon a successful write, or rejects if the write fails or stream becomes
|
||||
* errored before the writing process is initiated.
|
||||
*
|
||||
* Note that what "success" means is up to the underlying sink; it might indicate simply that the chunk has been
|
||||
* accepted, and not necessarily that it is safely saved to its ultimate destination.
|
||||
*/
|
||||
write(chunk: W): Promise<void>;
|
||||
}
|
||||
|
||||
export { }
|
||||
Generated
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
||||
// It should be published with your NPM package. It should not be tracked by Git.
|
||||
{
|
||||
"tsdocVersion": "0.12",
|
||||
"toolPackages": [
|
||||
{
|
||||
"packageName": "@microsoft/api-extractor",
|
||||
"packageVersion": "7.13.4"
|
||||
}
|
||||
]
|
||||
}
|
||||
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "web-streams-polyfill-es2018",
|
||||
"main": "../dist/polyfill.es2018",
|
||||
"browser": "../dist/polyfill.es2018.min.js",
|
||||
"module": "../dist/polyfill.es2018.mjs",
|
||||
"types": "../dist/types/polyfill.d.ts"
|
||||
}
|
||||
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "web-streams-polyfill-es6",
|
||||
"main": "../dist/polyfill.es6",
|
||||
"browser": "../dist/polyfill.es6.min.js",
|
||||
"module": "../dist/polyfill.es6.mjs",
|
||||
"types": "../dist/types/polyfill.d.ts"
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"name": "web-streams-polyfill",
|
||||
"version": "3.2.1",
|
||||
"description": "Web Streams, based on the WHATWG spec reference implementation",
|
||||
"main": "dist/polyfill",
|
||||
"browser": "dist/polyfill.min.js",
|
||||
"module": "dist/polyfill.mjs",
|
||||
"types": "dist/types/polyfill.d.ts",
|
||||
"typesVersions": {
|
||||
">=3.6": {
|
||||
"dist/types/*": [
|
||||
"dist/types/ts3.6/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"test": "npm run test:types && npm run test:unit && npm run test:wpt",
|
||||
"test:wpt": "node --expose_gc ./test/run-web-platform-tests.js",
|
||||
"pretest:wpt": "git submodule update --init --recursive",
|
||||
"test:types": "tsc -p ./test/types/tsconfig.json",
|
||||
"test:unit": "jasmine --config=test/unit/jasmine.json",
|
||||
"lint": "eslint \"src/**/*.ts\"",
|
||||
"build": "npm run build:bundle && npm run build:types",
|
||||
"build:bundle": "rollup -c",
|
||||
"build:types": "tsc --project . --emitDeclarationOnly --declarationDir ./lib && api-extractor run && node ./build/downlevel-dts.js",
|
||||
"accept:types": "tsc --project . --emitDeclarationOnly --declarationDir ./lib && api-extractor run --local && node ./build/downlevel-dts.js",
|
||||
"prepare": "npm run build"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"es6",
|
||||
"es2018",
|
||||
"ponyfill"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/MattiasBuelens/web-streams-polyfill.git"
|
||||
},
|
||||
"keywords": [
|
||||
"streams",
|
||||
"whatwg",
|
||||
"polyfill"
|
||||
],
|
||||
"author": "Mattias Buelens <mattias@buelens.com>",
|
||||
"contributors": [
|
||||
"Diwank Singh <diwank.singh@gmail.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/MattiasBuelens/web-streams-polyfill/issues"
|
||||
},
|
||||
"homepage": "https://github.com/MattiasBuelens/web-streams-polyfill#readme",
|
||||
"devDependencies": {
|
||||
"@microsoft/api-extractor": "^7.13.4",
|
||||
"@rollup/plugin-inject": "^4.0.2",
|
||||
"@rollup/plugin-replace": "^2.4.2",
|
||||
"@rollup/plugin-strip": "^2.0.0",
|
||||
"@rollup/plugin-typescript": "^8.2.1",
|
||||
"@types/node": "^14.14.37",
|
||||
"@typescript-eslint/eslint-plugin": "^4.21.0",
|
||||
"@typescript-eslint/parser": "^4.21.0",
|
||||
"@ungap/promise-all-settled": "^1.1.2",
|
||||
"eslint": "^7.23.0",
|
||||
"jasmine": "^3.7.0",
|
||||
"micromatch": "^4.0.2",
|
||||
"rollup": "^2.44.0",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"ts-morph": "^10.0.2",
|
||||
"tslib": "^2.2.0",
|
||||
"typescript": "^4.2.4",
|
||||
"wpt-runner": "^3.2.1"
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "web-streams-ponyfill-es2018",
|
||||
"main": "../../dist/ponyfill.es2018",
|
||||
"module": "../../dist/ponyfill.es2018.mjs",
|
||||
"types": "../../dist/types/polyfill.d.ts"
|
||||
}
|
||||
Generated
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "web-streams-ponyfill-es6",
|
||||
"main": "../../dist/ponyfill.es6",
|
||||
"module": "../../dist/ponyfill.es6.mjs",
|
||||
"types": "../../dist/types/polyfill.d.ts"
|
||||
}
|
||||
Generated
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "web-streams-ponyfill",
|
||||
"main": "../dist/ponyfill",
|
||||
"module": "../dist/ponyfill.mjs",
|
||||
"types": "../dist/types/polyfill.d.ts"
|
||||
}
|
||||
Reference in new issue
Block a user