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