@slicemachine/adapter-next 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/command-init.cjs +191 -0
- package/dist/hooks/command-init.cjs.map +1 -0
- package/dist/hooks/command-init.d.ts +3 -0
- package/dist/hooks/command-init.js +173 -0
- package/dist/hooks/command-init.js.map +1 -0
- package/dist/hooks/sliceSimulator-setup-read.cjs +2 -0
- package/dist/hooks/sliceSimulator-setup-read.cjs.map +1 -1
- package/dist/hooks/sliceSimulator-setup-read.js +2 -0
- package/dist/hooks/sliceSimulator-setup-read.js.map +1 -1
- package/dist/lib/checkPathExists.cjs +30 -0
- package/dist/lib/checkPathExists.cjs.map +1 -0
- package/dist/lib/checkPathExists.d.ts +2 -0
- package/dist/lib/checkPathExists.js +13 -0
- package/dist/lib/checkPathExists.js.map +1 -0
- package/dist/lib/rejectIfNecessary.cjs.map +1 -1
- package/dist/lib/rejectIfNecessary.js.map +1 -1
- package/dist/lib/upsertSliceLibraryIndexFile.cjs +31 -10
- package/dist/lib/upsertSliceLibraryIndexFile.cjs.map +1 -1
- package/dist/lib/upsertSliceLibraryIndexFile.js +31 -10
- package/dist/lib/upsertSliceLibraryIndexFile.js.map +1 -1
- package/dist/node_modules/data-uri-to-buffer/dist/index.cjs.map +1 -1
- package/dist/node_modules/data-uri-to-buffer/dist/index.js.map +1 -1
- package/dist/node_modules/fetch-blob/file.cjs +6 -0
- package/dist/node_modules/fetch-blob/file.cjs.map +1 -1
- package/dist/node_modules/fetch-blob/file.js +6 -0
- package/dist/node_modules/fetch-blob/file.js.map +1 -1
- package/dist/node_modules/fetch-blob/index.cjs +48 -2
- package/dist/node_modules/fetch-blob/index.cjs.map +1 -1
- package/dist/node_modules/fetch-blob/index.js +48 -2
- package/dist/node_modules/fetch-blob/index.js.map +1 -1
- package/dist/node_modules/fetch-blob/streams.cjs.map +1 -1
- package/dist/node_modules/fetch-blob/streams.js.map +1 -1
- package/dist/node_modules/formdata-polyfill/esm.min.cjs.map +1 -1
- package/dist/node_modules/formdata-polyfill/esm.min.js.map +1 -1
- package/dist/node_modules/node-domexception/index.cjs.map +1 -1
- package/dist/node_modules/node-domexception/index.js.map +1 -1
- package/dist/node_modules/node-fetch/src/body.cjs +25 -0
- package/dist/node_modules/node-fetch/src/body.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/body.js +25 -0
- package/dist/node_modules/node-fetch/src/body.js.map +1 -1
- package/dist/node_modules/node-fetch/src/errors/base.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/errors/base.js.map +1 -1
- package/dist/node_modules/node-fetch/src/errors/fetch-error.cjs +5 -0
- package/dist/node_modules/node-fetch/src/errors/fetch-error.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/errors/fetch-error.js +5 -0
- package/dist/node_modules/node-fetch/src/errors/fetch-error.js.map +1 -1
- package/dist/node_modules/node-fetch/src/headers.cjs +17 -0
- package/dist/node_modules/node-fetch/src/headers.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/headers.js +17 -0
- package/dist/node_modules/node-fetch/src/headers.js.map +1 -1
- package/dist/node_modules/node-fetch/src/index.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/index.js.map +1 -1
- package/dist/node_modules/node-fetch/src/request.cjs +13 -0
- package/dist/node_modules/node-fetch/src/request.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/request.js +13 -0
- package/dist/node_modules/node-fetch/src/request.js.map +1 -1
- package/dist/node_modules/node-fetch/src/response.cjs +13 -0
- package/dist/node_modules/node-fetch/src/response.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/response.js +13 -0
- package/dist/node_modules/node-fetch/src/response.js.map +1 -1
- package/dist/node_modules/node-fetch/src/utils/get-search.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/utils/get-search.js.map +1 -1
- package/dist/node_modules/node-fetch/src/utils/is.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/utils/is.js.map +1 -1
- package/dist/node_modules/node-fetch/src/utils/multipart-parser.cjs +6 -0
- package/dist/node_modules/node-fetch/src/utils/multipart-parser.cjs.map +1 -1
- package/dist/node_modules/node-fetch/src/utils/multipart-parser.js +6 -0
- package/dist/node_modules/node-fetch/src/utils/multipart-parser.js.map +1 -1
- package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs +223 -0
- package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs.map +1 -1
- package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js +223 -0
- package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +1 -1
- package/dist/plugin.cjs +4 -1
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +4 -1
- package/dist/plugin.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/package.json +15 -15
- package/src/hooks/command-init.ts +221 -0
- package/src/lib/checkPathExists.ts +12 -0
- package/src/lib/upsertSliceLibraryIndexFile.ts +37 -9
- package/src/plugin.ts +4 -0
- package/src/types.ts +1 -0
|
@@ -96,6 +96,10 @@ function requirePonyfill_es2018() {
|
|
|
96
96
|
get length() {
|
|
97
97
|
return this._size;
|
|
98
98
|
}
|
|
99
|
+
// For exception safety, this method is structured in order:
|
|
100
|
+
// 1. Read state
|
|
101
|
+
// 2. Calculate required state mutations
|
|
102
|
+
// 3. Perform state mutations
|
|
99
103
|
push(element) {
|
|
100
104
|
const oldBack = this._back;
|
|
101
105
|
let newBack = oldBack;
|
|
@@ -112,6 +116,8 @@ function requirePonyfill_es2018() {
|
|
|
112
116
|
}
|
|
113
117
|
++this._size;
|
|
114
118
|
}
|
|
119
|
+
// Like push(), shift() follows the read -> calculate -> mutate pattern for
|
|
120
|
+
// exception safety.
|
|
115
121
|
shift() {
|
|
116
122
|
const oldFront = this._front;
|
|
117
123
|
let newFront = oldFront;
|
|
@@ -131,6 +137,14 @@ function requirePonyfill_es2018() {
|
|
|
131
137
|
elements[oldCursor] = void 0;
|
|
132
138
|
return element;
|
|
133
139
|
}
|
|
140
|
+
// The tricky thing about forEach() is that it can be called
|
|
141
|
+
// re-entrantly. The queue may be mutated inside the callback. It is easy to
|
|
142
|
+
// see that push() within the callback has no negative effects since the end
|
|
143
|
+
// of the queue is checked for on every iteration. If shift() is called
|
|
144
|
+
// repeatedly within the callback then the next iteration may return an
|
|
145
|
+
// element that has been removed. In this case the callback will be called
|
|
146
|
+
// with undefined values until we either "catch up" with elements that still
|
|
147
|
+
// exist or reach the back of the queue.
|
|
134
148
|
forEach(callback) {
|
|
135
149
|
let i = this._cursor;
|
|
136
150
|
let node = this._front;
|
|
@@ -148,6 +162,8 @@ function requirePonyfill_es2018() {
|
|
|
148
162
|
++i;
|
|
149
163
|
}
|
|
150
164
|
}
|
|
165
|
+
// Return the element that would be returned if shift() was called now,
|
|
166
|
+
// without modifying the queue.
|
|
151
167
|
peek() {
|
|
152
168
|
const front = this._front;
|
|
153
169
|
const cursor = this._cursor;
|
|
@@ -325,12 +341,19 @@ function requirePonyfill_es2018() {
|
|
|
325
341
|
ReadableStreamReaderGenericInitialize(this, stream);
|
|
326
342
|
this._readRequests = new SimpleQueue();
|
|
327
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* Returns a promise that will be fulfilled when the stream becomes closed,
|
|
346
|
+
* or rejected if the stream ever errors or the reader's lock is released before the stream finishes closing.
|
|
347
|
+
*/
|
|
328
348
|
get closed() {
|
|
329
349
|
if (!IsReadableStreamDefaultReader(this)) {
|
|
330
350
|
return promiseRejectedWith(defaultReaderBrandCheckException("closed"));
|
|
331
351
|
}
|
|
332
352
|
return this._closedPromise;
|
|
333
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.
|
|
356
|
+
*/
|
|
334
357
|
cancel(reason = void 0) {
|
|
335
358
|
if (!IsReadableStreamDefaultReader(this)) {
|
|
336
359
|
return promiseRejectedWith(defaultReaderBrandCheckException("cancel"));
|
|
@@ -340,6 +363,11 @@ function requirePonyfill_es2018() {
|
|
|
340
363
|
}
|
|
341
364
|
return ReadableStreamReaderGenericCancel(this, reason);
|
|
342
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* Returns a promise that allows access to the next chunk from the stream's internal queue, if available.
|
|
368
|
+
*
|
|
369
|
+
* If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.
|
|
370
|
+
*/
|
|
343
371
|
read() {
|
|
344
372
|
if (!IsReadableStreamDefaultReader(this)) {
|
|
345
373
|
return promiseRejectedWith(defaultReaderBrandCheckException("read"));
|
|
@@ -361,6 +389,15 @@ function requirePonyfill_es2018() {
|
|
|
361
389
|
ReadableStreamDefaultReaderRead(this, readRequest);
|
|
362
390
|
return promise;
|
|
363
391
|
}
|
|
392
|
+
/**
|
|
393
|
+
* Releases the reader's lock on the corresponding stream. After the lock is released, the reader is no longer active.
|
|
394
|
+
* If the associated stream is errored when the lock is released, the reader will appear errored in the same way
|
|
395
|
+
* from now on; otherwise, the reader will appear closed.
|
|
396
|
+
*
|
|
397
|
+
* A reader's lock cannot be released while it still has a pending read request, i.e., if a promise returned by
|
|
398
|
+
* the reader's {@link ReadableStreamDefaultReader.read | read()} method has not yet been settled. Attempting to
|
|
399
|
+
* do so will throw a `TypeError` and leave the reader locked to the stream.
|
|
400
|
+
*/
|
|
364
401
|
releaseLock() {
|
|
365
402
|
if (!IsReadableStreamDefaultReader(this)) {
|
|
366
403
|
throw defaultReaderBrandCheckException("releaseLock");
|
|
@@ -587,6 +624,9 @@ function requirePonyfill_es2018() {
|
|
|
587
624
|
constructor() {
|
|
588
625
|
throw new TypeError("Illegal constructor");
|
|
589
626
|
}
|
|
627
|
+
/**
|
|
628
|
+
* Returns the view for writing in to, or `null` if the BYOB request has already been responded to.
|
|
629
|
+
*/
|
|
590
630
|
get view() {
|
|
591
631
|
if (!IsReadableStreamBYOBRequest(this)) {
|
|
592
632
|
throw byobRequestBrandCheckException("view");
|
|
@@ -637,18 +677,29 @@ function requirePonyfill_es2018() {
|
|
|
637
677
|
constructor() {
|
|
638
678
|
throw new TypeError("Illegal constructor");
|
|
639
679
|
}
|
|
680
|
+
/**
|
|
681
|
+
* Returns the current BYOB pull request, or `null` if there isn't one.
|
|
682
|
+
*/
|
|
640
683
|
get byobRequest() {
|
|
641
684
|
if (!IsReadableByteStreamController(this)) {
|
|
642
685
|
throw byteStreamControllerBrandCheckException("byobRequest");
|
|
643
686
|
}
|
|
644
687
|
return ReadableByteStreamControllerGetBYOBRequest(this);
|
|
645
688
|
}
|
|
689
|
+
/**
|
|
690
|
+
* Returns the desired size to fill the controlled stream's internal queue. It can be negative, if the queue is
|
|
691
|
+
* over-full. An underlying byte source ought to use this information to determine when and how to apply backpressure.
|
|
692
|
+
*/
|
|
646
693
|
get desiredSize() {
|
|
647
694
|
if (!IsReadableByteStreamController(this)) {
|
|
648
695
|
throw byteStreamControllerBrandCheckException("desiredSize");
|
|
649
696
|
}
|
|
650
697
|
return ReadableByteStreamControllerGetDesiredSize(this);
|
|
651
698
|
}
|
|
699
|
+
/**
|
|
700
|
+
* Closes the controlled readable stream. Consumers will still be able to read any previously-enqueued chunks from
|
|
701
|
+
* the stream, but once those are read, the stream will become closed.
|
|
702
|
+
*/
|
|
652
703
|
close() {
|
|
653
704
|
if (!IsReadableByteStreamController(this)) {
|
|
654
705
|
throw byteStreamControllerBrandCheckException("close");
|
|
@@ -685,12 +736,16 @@ function requirePonyfill_es2018() {
|
|
|
685
736
|
}
|
|
686
737
|
ReadableByteStreamControllerEnqueue(this, chunk);
|
|
687
738
|
}
|
|
739
|
+
/**
|
|
740
|
+
* Errors the controlled readable stream, making all future interactions with it fail with the given error `e`.
|
|
741
|
+
*/
|
|
688
742
|
error(e = void 0) {
|
|
689
743
|
if (!IsReadableByteStreamController(this)) {
|
|
690
744
|
throw byteStreamControllerBrandCheckException("error");
|
|
691
745
|
}
|
|
692
746
|
ReadableByteStreamControllerError(this, e);
|
|
693
747
|
}
|
|
748
|
+
/** @internal */
|
|
694
749
|
[CancelSteps](reason) {
|
|
695
750
|
ReadableByteStreamControllerClearPendingPullIntos(this);
|
|
696
751
|
ResetQueue(this);
|
|
@@ -698,6 +753,7 @@ function requirePonyfill_es2018() {
|
|
|
698
753
|
ReadableByteStreamControllerClearAlgorithms(this);
|
|
699
754
|
return result;
|
|
700
755
|
}
|
|
756
|
+
/** @internal */
|
|
701
757
|
[PullSteps](readRequest) {
|
|
702
758
|
const stream = this._controlledReadableByteStream;
|
|
703
759
|
if (this._queueTotalSize > 0) {
|
|
@@ -1205,12 +1261,19 @@ function requirePonyfill_es2018() {
|
|
|
1205
1261
|
ReadableStreamReaderGenericInitialize(this, stream);
|
|
1206
1262
|
this._readIntoRequests = new SimpleQueue();
|
|
1207
1263
|
}
|
|
1264
|
+
/**
|
|
1265
|
+
* Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or
|
|
1266
|
+
* the reader's lock is released before the stream finishes closing.
|
|
1267
|
+
*/
|
|
1208
1268
|
get closed() {
|
|
1209
1269
|
if (!IsReadableStreamBYOBReader(this)) {
|
|
1210
1270
|
return promiseRejectedWith(byobReaderBrandCheckException("closed"));
|
|
1211
1271
|
}
|
|
1212
1272
|
return this._closedPromise;
|
|
1213
1273
|
}
|
|
1274
|
+
/**
|
|
1275
|
+
* If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.
|
|
1276
|
+
*/
|
|
1214
1277
|
cancel(reason = void 0) {
|
|
1215
1278
|
if (!IsReadableStreamBYOBReader(this)) {
|
|
1216
1279
|
return promiseRejectedWith(byobReaderBrandCheckException("cancel"));
|
|
@@ -1220,6 +1283,11 @@ function requirePonyfill_es2018() {
|
|
|
1220
1283
|
}
|
|
1221
1284
|
return ReadableStreamReaderGenericCancel(this, reason);
|
|
1222
1285
|
}
|
|
1286
|
+
/**
|
|
1287
|
+
* Attempts to reads bytes into view, and returns a promise resolved with the result.
|
|
1288
|
+
*
|
|
1289
|
+
* If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.
|
|
1290
|
+
*/
|
|
1223
1291
|
read(view) {
|
|
1224
1292
|
if (!IsReadableStreamBYOBReader(this)) {
|
|
1225
1293
|
return promiseRejectedWith(byobReaderBrandCheckException("read"));
|
|
@@ -1252,6 +1320,15 @@ function requirePonyfill_es2018() {
|
|
|
1252
1320
|
ReadableStreamBYOBReaderRead(this, view, readIntoRequest);
|
|
1253
1321
|
return promise;
|
|
1254
1322
|
}
|
|
1323
|
+
/**
|
|
1324
|
+
* Releases the reader's lock on the corresponding stream. After the lock is released, the reader is no longer active.
|
|
1325
|
+
* If the associated stream is errored when the lock is released, the reader will appear errored in the same way
|
|
1326
|
+
* from now on; otherwise, the reader will appear closed.
|
|
1327
|
+
*
|
|
1328
|
+
* A reader's lock cannot be released while it still has a pending read request, i.e., if a promise returned by
|
|
1329
|
+
* the reader's {@link ReadableStreamBYOBReader.read | read()} method has not yet been settled. Attempting to
|
|
1330
|
+
* do so will throw a `TypeError` and leave the reader locked to the stream.
|
|
1331
|
+
*/
|
|
1255
1332
|
releaseLock() {
|
|
1256
1333
|
if (!IsReadableStreamBYOBReader(this)) {
|
|
1257
1334
|
throw byobReaderBrandCheckException("releaseLock");
|
|
@@ -1399,12 +1476,24 @@ function requirePonyfill_es2018() {
|
|
|
1399
1476
|
const highWaterMark = ExtractHighWaterMark(strategy, 1);
|
|
1400
1477
|
SetUpWritableStreamDefaultControllerFromUnderlyingSink(this, underlyingSink, highWaterMark, sizeAlgorithm);
|
|
1401
1478
|
}
|
|
1479
|
+
/**
|
|
1480
|
+
* Returns whether or not the writable stream is locked to a writer.
|
|
1481
|
+
*/
|
|
1402
1482
|
get locked() {
|
|
1403
1483
|
if (!IsWritableStream(this)) {
|
|
1404
1484
|
throw streamBrandCheckException$2("locked");
|
|
1405
1485
|
}
|
|
1406
1486
|
return IsWritableStreamLocked(this);
|
|
1407
1487
|
}
|
|
1488
|
+
/**
|
|
1489
|
+
* Aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be
|
|
1490
|
+
* immediately moved to an errored state, with any queued-up writes discarded. This will also execute any abort
|
|
1491
|
+
* mechanism of the underlying sink.
|
|
1492
|
+
*
|
|
1493
|
+
* The returned promise will fulfill if the stream shuts down successfully, or reject if the underlying sink signaled
|
|
1494
|
+
* that there was an error doing so. Additionally, it will reject with a `TypeError` (without attempting to cancel
|
|
1495
|
+
* the stream) if the stream is currently locked.
|
|
1496
|
+
*/
|
|
1408
1497
|
abort(reason = void 0) {
|
|
1409
1498
|
if (!IsWritableStream(this)) {
|
|
1410
1499
|
return promiseRejectedWith(streamBrandCheckException$2("abort"));
|
|
@@ -1414,6 +1503,14 @@ function requirePonyfill_es2018() {
|
|
|
1414
1503
|
}
|
|
1415
1504
|
return WritableStreamAbort(this, reason);
|
|
1416
1505
|
}
|
|
1506
|
+
/**
|
|
1507
|
+
* Closes the stream. The underlying sink will finish processing any previously-written chunks, before invoking its
|
|
1508
|
+
* close behavior. During this time any further attempts to write will fail (without erroring the stream).
|
|
1509
|
+
*
|
|
1510
|
+
* The method returns a promise that will fulfill if all remaining chunks are successfully written and the stream
|
|
1511
|
+
* successfully closes, or rejects if an error is encountered during this process. Additionally, it will reject with
|
|
1512
|
+
* a `TypeError` (without attempting to cancel the stream) if the stream is currently locked.
|
|
1513
|
+
*/
|
|
1417
1514
|
close() {
|
|
1418
1515
|
if (!IsWritableStream(this)) {
|
|
1419
1516
|
return promiseRejectedWith(streamBrandCheckException$2("close"));
|
|
@@ -1426,6 +1523,14 @@ function requirePonyfill_es2018() {
|
|
|
1426
1523
|
}
|
|
1427
1524
|
return WritableStreamClose(this);
|
|
1428
1525
|
}
|
|
1526
|
+
/**
|
|
1527
|
+
* Creates a {@link WritableStreamDefaultWriter | writer} and locks the stream to the new writer. While the stream
|
|
1528
|
+
* is locked, no other writer can be acquired until this one is released.
|
|
1529
|
+
*
|
|
1530
|
+
* This functionality is especially useful for creating abstractions that desire the ability to write to a stream
|
|
1531
|
+
* without interruption or interleaving. By getting a writer for the stream, you can ensure nobody else can write at
|
|
1532
|
+
* the same time, which would cause the resulting written data to be unpredictable and probably useless.
|
|
1533
|
+
*/
|
|
1429
1534
|
getWriter() {
|
|
1430
1535
|
if (!IsWritableStream(this)) {
|
|
1431
1536
|
throw streamBrandCheckException$2("getWriter");
|
|
@@ -1697,12 +1802,24 @@ function requirePonyfill_es2018() {
|
|
|
1697
1802
|
defaultWriterClosedPromiseInitializeAsRejected(this, storedError);
|
|
1698
1803
|
}
|
|
1699
1804
|
}
|
|
1805
|
+
/**
|
|
1806
|
+
* Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or
|
|
1807
|
+
* the writer’s lock is released before the stream finishes closing.
|
|
1808
|
+
*/
|
|
1700
1809
|
get closed() {
|
|
1701
1810
|
if (!IsWritableStreamDefaultWriter(this)) {
|
|
1702
1811
|
return promiseRejectedWith(defaultWriterBrandCheckException("closed"));
|
|
1703
1812
|
}
|
|
1704
1813
|
return this._closedPromise;
|
|
1705
1814
|
}
|
|
1815
|
+
/**
|
|
1816
|
+
* Returns the desired size to fill the stream’s internal queue. It can be negative, if the queue is over-full.
|
|
1817
|
+
* A producer can use this information to determine the right amount of data to write.
|
|
1818
|
+
*
|
|
1819
|
+
* It will be `null` if the stream cannot be successfully written to (due to either being errored, or having an abort
|
|
1820
|
+
* queued up). It will return zero if the stream is closed. And the getter will throw an exception if invoked when
|
|
1821
|
+
* the writer’s lock is released.
|
|
1822
|
+
*/
|
|
1706
1823
|
get desiredSize() {
|
|
1707
1824
|
if (!IsWritableStreamDefaultWriter(this)) {
|
|
1708
1825
|
throw defaultWriterBrandCheckException("desiredSize");
|
|
@@ -1712,12 +1829,23 @@ function requirePonyfill_es2018() {
|
|
|
1712
1829
|
}
|
|
1713
1830
|
return WritableStreamDefaultWriterGetDesiredSize(this);
|
|
1714
1831
|
}
|
|
1832
|
+
/**
|
|
1833
|
+
* Returns a promise that will be fulfilled when the desired size to fill the stream’s internal queue transitions
|
|
1834
|
+
* from non-positive to positive, signaling that it is no longer applying backpressure. Once the desired size dips
|
|
1835
|
+
* back to zero or below, the getter will return a new promise that stays pending until the next transition.
|
|
1836
|
+
*
|
|
1837
|
+
* If the stream becomes errored or aborted, or the writer’s lock is released, the returned promise will become
|
|
1838
|
+
* rejected.
|
|
1839
|
+
*/
|
|
1715
1840
|
get ready() {
|
|
1716
1841
|
if (!IsWritableStreamDefaultWriter(this)) {
|
|
1717
1842
|
return promiseRejectedWith(defaultWriterBrandCheckException("ready"));
|
|
1718
1843
|
}
|
|
1719
1844
|
return this._readyPromise;
|
|
1720
1845
|
}
|
|
1846
|
+
/**
|
|
1847
|
+
* If the reader is active, behaves the same as {@link WritableStream.abort | stream.abort(reason)}.
|
|
1848
|
+
*/
|
|
1721
1849
|
abort(reason = void 0) {
|
|
1722
1850
|
if (!IsWritableStreamDefaultWriter(this)) {
|
|
1723
1851
|
return promiseRejectedWith(defaultWriterBrandCheckException("abort"));
|
|
@@ -1727,6 +1855,9 @@ function requirePonyfill_es2018() {
|
|
|
1727
1855
|
}
|
|
1728
1856
|
return WritableStreamDefaultWriterAbort(this, reason);
|
|
1729
1857
|
}
|
|
1858
|
+
/**
|
|
1859
|
+
* If the reader is active, behaves the same as {@link WritableStream.close | stream.close()}.
|
|
1860
|
+
*/
|
|
1730
1861
|
close() {
|
|
1731
1862
|
if (!IsWritableStreamDefaultWriter(this)) {
|
|
1732
1863
|
return promiseRejectedWith(defaultWriterBrandCheckException("close"));
|
|
@@ -1740,6 +1871,16 @@ function requirePonyfill_es2018() {
|
|
|
1740
1871
|
}
|
|
1741
1872
|
return WritableStreamDefaultWriterClose(this);
|
|
1742
1873
|
}
|
|
1874
|
+
/**
|
|
1875
|
+
* Releases the writer’s lock on the corresponding stream. After the lock is released, the writer is no longer active.
|
|
1876
|
+
* If the associated stream is errored when the lock is released, the writer will appear errored in the same way from
|
|
1877
|
+
* now on; otherwise, the writer will appear closed.
|
|
1878
|
+
*
|
|
1879
|
+
* Note that the lock can still be released even if some ongoing writes have not yet finished (i.e. even if the
|
|
1880
|
+
* promises returned from previous calls to {@link WritableStreamDefaultWriter.write | write()} have not yet settled).
|
|
1881
|
+
* It’s not necessary to hold the lock on the writer for the duration of the write; the lock instead simply prevents
|
|
1882
|
+
* other producers from writing in an interleaved manner.
|
|
1883
|
+
*/
|
|
1743
1884
|
releaseLock() {
|
|
1744
1885
|
if (!IsWritableStreamDefaultWriter(this)) {
|
|
1745
1886
|
throw defaultWriterBrandCheckException("releaseLock");
|
|
@@ -1862,12 +2003,22 @@ function requirePonyfill_es2018() {
|
|
|
1862
2003
|
constructor() {
|
|
1863
2004
|
throw new TypeError("Illegal constructor");
|
|
1864
2005
|
}
|
|
2006
|
+
/**
|
|
2007
|
+
* The reason which was passed to `WritableStream.abort(reason)` when the stream was aborted.
|
|
2008
|
+
*
|
|
2009
|
+
* @deprecated
|
|
2010
|
+
* This property has been removed from the specification, see https://github.com/whatwg/streams/pull/1177.
|
|
2011
|
+
* Use {@link WritableStreamDefaultController.signal}'s `reason` instead.
|
|
2012
|
+
*/
|
|
1865
2013
|
get abortReason() {
|
|
1866
2014
|
if (!IsWritableStreamDefaultController(this)) {
|
|
1867
2015
|
throw defaultControllerBrandCheckException$2("abortReason");
|
|
1868
2016
|
}
|
|
1869
2017
|
return this._abortReason;
|
|
1870
2018
|
}
|
|
2019
|
+
/**
|
|
2020
|
+
* An `AbortSignal` that can be used to abort the pending write or close operation when the stream is aborted.
|
|
2021
|
+
*/
|
|
1871
2022
|
get signal() {
|
|
1872
2023
|
if (!IsWritableStreamDefaultController(this)) {
|
|
1873
2024
|
throw defaultControllerBrandCheckException$2("signal");
|
|
@@ -1877,6 +2028,13 @@ function requirePonyfill_es2018() {
|
|
|
1877
2028
|
}
|
|
1878
2029
|
return this._abortController.signal;
|
|
1879
2030
|
}
|
|
2031
|
+
/**
|
|
2032
|
+
* Closes the controlled writable stream, making all future interactions with it fail with the given error `e`.
|
|
2033
|
+
*
|
|
2034
|
+
* This method is rarely used, since usually it suffices to return a rejected promise from one of the underlying
|
|
2035
|
+
* sink's methods. However, it can be useful for suddenly shutting down a stream in response to an event outside the
|
|
2036
|
+
* normal lifecycle of interactions with the underlying sink.
|
|
2037
|
+
*/
|
|
1880
2038
|
error(e = void 0) {
|
|
1881
2039
|
if (!IsWritableStreamDefaultController(this)) {
|
|
1882
2040
|
throw defaultControllerBrandCheckException$2("error");
|
|
@@ -1887,11 +2045,13 @@ function requirePonyfill_es2018() {
|
|
|
1887
2045
|
}
|
|
1888
2046
|
WritableStreamDefaultControllerError(this, e);
|
|
1889
2047
|
}
|
|
2048
|
+
/** @internal */
|
|
1890
2049
|
[AbortSteps](reason) {
|
|
1891
2050
|
const result = this._abortAlgorithm(reason);
|
|
1892
2051
|
WritableStreamDefaultControllerClearAlgorithms(this);
|
|
1893
2052
|
return result;
|
|
1894
2053
|
}
|
|
2054
|
+
/** @internal */
|
|
1895
2055
|
[ErrorSteps]() {
|
|
1896
2056
|
ResetQueue(this);
|
|
1897
2057
|
}
|
|
@@ -2336,12 +2496,20 @@ function requirePonyfill_es2018() {
|
|
|
2336
2496
|
constructor() {
|
|
2337
2497
|
throw new TypeError("Illegal constructor");
|
|
2338
2498
|
}
|
|
2499
|
+
/**
|
|
2500
|
+
* Returns the desired size to fill the controlled stream's internal queue. It can be negative, if the queue is
|
|
2501
|
+
* over-full. An underlying source ought to use this information to determine when and how to apply backpressure.
|
|
2502
|
+
*/
|
|
2339
2503
|
get desiredSize() {
|
|
2340
2504
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2341
2505
|
throw defaultControllerBrandCheckException$1("desiredSize");
|
|
2342
2506
|
}
|
|
2343
2507
|
return ReadableStreamDefaultControllerGetDesiredSize(this);
|
|
2344
2508
|
}
|
|
2509
|
+
/**
|
|
2510
|
+
* Closes the controlled readable stream. Consumers will still be able to read any previously-enqueued chunks from
|
|
2511
|
+
* the stream, but once those are read, the stream will become closed.
|
|
2512
|
+
*/
|
|
2345
2513
|
close() {
|
|
2346
2514
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2347
2515
|
throw defaultControllerBrandCheckException$1("close");
|
|
@@ -2360,18 +2528,23 @@ function requirePonyfill_es2018() {
|
|
|
2360
2528
|
}
|
|
2361
2529
|
return ReadableStreamDefaultControllerEnqueue(this, chunk);
|
|
2362
2530
|
}
|
|
2531
|
+
/**
|
|
2532
|
+
* Errors the controlled readable stream, making all future interactions with it fail with the given error `e`.
|
|
2533
|
+
*/
|
|
2363
2534
|
error(e = void 0) {
|
|
2364
2535
|
if (!IsReadableStreamDefaultController(this)) {
|
|
2365
2536
|
throw defaultControllerBrandCheckException$1("error");
|
|
2366
2537
|
}
|
|
2367
2538
|
ReadableStreamDefaultControllerError(this, e);
|
|
2368
2539
|
}
|
|
2540
|
+
/** @internal */
|
|
2369
2541
|
[CancelSteps](reason) {
|
|
2370
2542
|
ResetQueue(this);
|
|
2371
2543
|
const result = this._cancelAlgorithm(reason);
|
|
2372
2544
|
ReadableStreamDefaultControllerClearAlgorithms(this);
|
|
2373
2545
|
return result;
|
|
2374
2546
|
}
|
|
2547
|
+
/** @internal */
|
|
2375
2548
|
[PullSteps](readRequest) {
|
|
2376
2549
|
const stream = this._controlledReadableStream;
|
|
2377
2550
|
if (this._queue.length > 0) {
|
|
@@ -2976,12 +3149,21 @@ function requirePonyfill_es2018() {
|
|
|
2976
3149
|
SetUpReadableStreamDefaultControllerFromUnderlyingSource(this, underlyingSource, highWaterMark, sizeAlgorithm);
|
|
2977
3150
|
}
|
|
2978
3151
|
}
|
|
3152
|
+
/**
|
|
3153
|
+
* Whether or not the readable stream is locked to a {@link ReadableStreamDefaultReader | reader}.
|
|
3154
|
+
*/
|
|
2979
3155
|
get locked() {
|
|
2980
3156
|
if (!IsReadableStream(this)) {
|
|
2981
3157
|
throw streamBrandCheckException$1("locked");
|
|
2982
3158
|
}
|
|
2983
3159
|
return IsReadableStreamLocked(this);
|
|
2984
3160
|
}
|
|
3161
|
+
/**
|
|
3162
|
+
* Cancels the stream, signaling a loss of interest in the stream by a consumer.
|
|
3163
|
+
*
|
|
3164
|
+
* The supplied `reason` argument will be given to the underlying source's {@link UnderlyingSource.cancel | cancel()}
|
|
3165
|
+
* method, which might or might not use it.
|
|
3166
|
+
*/
|
|
2985
3167
|
cancel(reason = void 0) {
|
|
2986
3168
|
if (!IsReadableStream(this)) {
|
|
2987
3169
|
return promiseRejectedWith(streamBrandCheckException$1("cancel"));
|
|
@@ -3042,6 +3224,17 @@ function requirePonyfill_es2018() {
|
|
|
3042
3224
|
}
|
|
3043
3225
|
return ReadableStreamPipeTo(this, destination, options.preventClose, options.preventAbort, options.preventCancel, options.signal);
|
|
3044
3226
|
}
|
|
3227
|
+
/**
|
|
3228
|
+
* Tees this readable stream, returning a two-element array containing the two resulting branches as
|
|
3229
|
+
* new {@link ReadableStream} instances.
|
|
3230
|
+
*
|
|
3231
|
+
* Teeing a stream will lock it, preventing any other consumer from acquiring a reader.
|
|
3232
|
+
* To cancel the stream, cancel both of the resulting branches; a composite cancellation reason will then be
|
|
3233
|
+
* propagated to the stream's underlying source.
|
|
3234
|
+
*
|
|
3235
|
+
* Note that the chunks seen in each branch will be the same object. If the chunks are not immutable,
|
|
3236
|
+
* this could allow interference between the two branches.
|
|
3237
|
+
*/
|
|
3045
3238
|
tee() {
|
|
3046
3239
|
if (!IsReadableStream(this)) {
|
|
3047
3240
|
throw streamBrandCheckException$1("tee");
|
|
@@ -3194,12 +3387,18 @@ function requirePonyfill_es2018() {
|
|
|
3194
3387
|
options = convertQueuingStrategyInit(options, "First parameter");
|
|
3195
3388
|
this._byteLengthQueuingStrategyHighWaterMark = options.highWaterMark;
|
|
3196
3389
|
}
|
|
3390
|
+
/**
|
|
3391
|
+
* Returns the high water mark provided to the constructor.
|
|
3392
|
+
*/
|
|
3197
3393
|
get highWaterMark() {
|
|
3198
3394
|
if (!IsByteLengthQueuingStrategy(this)) {
|
|
3199
3395
|
throw byteLengthBrandCheckException("highWaterMark");
|
|
3200
3396
|
}
|
|
3201
3397
|
return this._byteLengthQueuingStrategyHighWaterMark;
|
|
3202
3398
|
}
|
|
3399
|
+
/**
|
|
3400
|
+
* Measures the size of `chunk` by returning the value of its `byteLength` property.
|
|
3401
|
+
*/
|
|
3203
3402
|
get size() {
|
|
3204
3403
|
if (!IsByteLengthQueuingStrategy(this)) {
|
|
3205
3404
|
throw byteLengthBrandCheckException("size");
|
|
@@ -3245,12 +3444,19 @@ function requirePonyfill_es2018() {
|
|
|
3245
3444
|
options = convertQueuingStrategyInit(options, "First parameter");
|
|
3246
3445
|
this._countQueuingStrategyHighWaterMark = options.highWaterMark;
|
|
3247
3446
|
}
|
|
3447
|
+
/**
|
|
3448
|
+
* Returns the high water mark provided to the constructor.
|
|
3449
|
+
*/
|
|
3248
3450
|
get highWaterMark() {
|
|
3249
3451
|
if (!IsCountQueuingStrategy(this)) {
|
|
3250
3452
|
throw countBrandCheckException("highWaterMark");
|
|
3251
3453
|
}
|
|
3252
3454
|
return this._countQueuingStrategyHighWaterMark;
|
|
3253
3455
|
}
|
|
3456
|
+
/**
|
|
3457
|
+
* Measures the size of `chunk` by always returning 1.
|
|
3458
|
+
* This ensures that the total queue size is a count of the number of chunks in the queue.
|
|
3459
|
+
*/
|
|
3254
3460
|
get size() {
|
|
3255
3461
|
if (!IsCountQueuingStrategy(this)) {
|
|
3256
3462
|
throw countBrandCheckException("size");
|
|
@@ -3337,12 +3543,18 @@ function requirePonyfill_es2018() {
|
|
|
3337
3543
|
startPromise_resolve(void 0);
|
|
3338
3544
|
}
|
|
3339
3545
|
}
|
|
3546
|
+
/**
|
|
3547
|
+
* The readable side of the transform stream.
|
|
3548
|
+
*/
|
|
3340
3549
|
get readable() {
|
|
3341
3550
|
if (!IsTransformStream(this)) {
|
|
3342
3551
|
throw streamBrandCheckException("readable");
|
|
3343
3552
|
}
|
|
3344
3553
|
return this._readable;
|
|
3345
3554
|
}
|
|
3555
|
+
/**
|
|
3556
|
+
* The writable side of the transform stream.
|
|
3557
|
+
*/
|
|
3346
3558
|
get writable() {
|
|
3347
3559
|
if (!IsTransformStream(this)) {
|
|
3348
3560
|
throw streamBrandCheckException("writable");
|
|
@@ -3421,6 +3633,9 @@ function requirePonyfill_es2018() {
|
|
|
3421
3633
|
constructor() {
|
|
3422
3634
|
throw new TypeError("Illegal constructor");
|
|
3423
3635
|
}
|
|
3636
|
+
/**
|
|
3637
|
+
* Returns the desired size to fill the readable side’s internal queue. It can be negative, if the queue is over-full.
|
|
3638
|
+
*/
|
|
3424
3639
|
get desiredSize() {
|
|
3425
3640
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3426
3641
|
throw defaultControllerBrandCheckException("desiredSize");
|
|
@@ -3434,12 +3649,20 @@ function requirePonyfill_es2018() {
|
|
|
3434
3649
|
}
|
|
3435
3650
|
TransformStreamDefaultControllerEnqueue(this, chunk);
|
|
3436
3651
|
}
|
|
3652
|
+
/**
|
|
3653
|
+
* Errors both the readable side and the writable side of the controlled transform stream, making all future
|
|
3654
|
+
* interactions with it fail with the given error `e`. Any chunks queued for transformation will be discarded.
|
|
3655
|
+
*/
|
|
3437
3656
|
error(reason = void 0) {
|
|
3438
3657
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3439
3658
|
throw defaultControllerBrandCheckException("error");
|
|
3440
3659
|
}
|
|
3441
3660
|
TransformStreamDefaultControllerError(this, reason);
|
|
3442
3661
|
}
|
|
3662
|
+
/**
|
|
3663
|
+
* Closes the readable side and errors the writable side of the controlled transform stream. This is useful when the
|
|
3664
|
+
* transformer only needs to consume a portion of the chunks written to the writable side.
|
|
3665
|
+
*/
|
|
3443
3666
|
terminate() {
|
|
3444
3667
|
if (!IsTransformStreamDefaultController(this)) {
|
|
3445
3668
|
throw defaultControllerBrandCheckException("terminate");
|