effect 3.16.7 → 3.16.8

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.
@@ -1,4 +1,4 @@
1
- let moduleVersion = "3.16.7";
1
+ let moduleVersion = "3.16.8";
2
2
  export const getCurrentVersion = () => moduleVersion;
3
3
  export const setCurrentVersion = version => {
4
4
  moduleVersion = version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effect",
3
- "version": "3.16.7",
3
+ "version": "3.16.8",
4
4
  "description": "The missing standard library for TypeScript, for writing production-grade software.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -5401,25 +5401,21 @@ export const repeatWith = dual<
5401
5401
  Ref.get(driver.iterationMeta)
5402
5402
  )
5403
5403
 
5404
- const scheduleOutput = pipe(driver.last, Effect.orDie, Effect.map(options.onSchedule))
5405
5404
  const process = pipe(self, provideLastIterationInfo, map(options.onElement), toChannel)
5406
5405
  const loop: Channel.Channel<Chunk.Chunk<C>, unknown, E, unknown, void, unknown, R | R2> = channel.unwrap(
5407
- Effect.match(driver.next(void 0), {
5408
- onFailure: () => core.void,
5409
- onSuccess: () =>
5410
- pipe(
5411
- process,
5412
- channel.zipRight(
5413
- pipe(
5414
- scheduleOutput,
5415
- Effect.map((c) => pipe(core.write(Chunk.of(c)), core.flatMap(() => loop))),
5416
- channel.unwrap
5417
- )
5406
+ Effect.match(
5407
+ driver.next(void 0),
5408
+ {
5409
+ onFailure: () => core.void,
5410
+ onSuccess: (output) =>
5411
+ core.flatMap(
5412
+ process,
5413
+ () => channel.zipRight(core.write(Chunk.of(options.onSchedule(output))), loop)
5418
5414
  )
5419
- )
5420
- })
5415
+ }
5416
+ )
5421
5417
  )
5422
- return new StreamImpl(pipe(process, channel.zipRight(loop)))
5418
+ return new StreamImpl(channel.zipRight(process, loop))
5423
5419
  }),
5424
5420
  unwrap
5425
5421
  )
@@ -7218,20 +7214,26 @@ export const toReadableStreamRuntime = dual<
7218
7214
 
7219
7215
  return new ReadableStream<A>({
7220
7216
  start(controller) {
7221
- fiber = runFork(runForEachChunk(self, (chunk) =>
7222
- latch.whenOpen(Effect.sync(() => {
7217
+ fiber = runFork(runForEachChunk(self, (chunk) => {
7218
+ if (chunk.length === 0) return Effect.void
7219
+ return latch.whenOpen(Effect.sync(() => {
7223
7220
  latch.unsafeClose()
7224
7221
  for (const item of chunk) {
7225
7222
  controller.enqueue(item)
7226
7223
  }
7227
7224
  currentResolve!()
7228
7225
  currentResolve = undefined
7229
- }))))
7226
+ }))
7227
+ }))
7230
7228
  fiber.addObserver((exit) => {
7231
- if (exit._tag === "Failure") {
7232
- controller.error(Cause.squash(exit.cause))
7233
- } else {
7234
- controller.close()
7229
+ try {
7230
+ if (exit._tag === "Failure") {
7231
+ controller.error(Cause.squash(exit.cause))
7232
+ } else {
7233
+ controller.close()
7234
+ }
7235
+ } catch {
7236
+ // ignore
7235
7237
  }
7236
7238
  })
7237
7239
  },
@@ -1,4 +1,4 @@
1
- let moduleVersion = "3.16.7"
1
+ let moduleVersion = "3.16.8"
2
2
 
3
3
  export const getCurrentVersion = () => moduleVersion
4
4