@effect/platform-node-shared 4.0.0-beta.66 → 4.0.0-beta.67

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 (54) hide show
  1. package/dist/NodeChildProcessSpawner.d.ts +3 -3
  2. package/dist/NodeChildProcessSpawner.js +2 -2
  3. package/dist/NodeClusterSocket.d.ts +8 -2
  4. package/dist/NodeClusterSocket.d.ts.map +1 -1
  5. package/dist/NodeClusterSocket.js +27 -3
  6. package/dist/NodeClusterSocket.js.map +1 -1
  7. package/dist/NodeFileSystem.d.ts +4 -1
  8. package/dist/NodeFileSystem.d.ts.map +1 -1
  9. package/dist/NodeFileSystem.js +23 -2
  10. package/dist/NodeFileSystem.js.map +1 -1
  11. package/dist/NodePath.d.ts +12 -3
  12. package/dist/NodePath.d.ts.map +1 -1
  13. package/dist/NodePath.js +27 -4
  14. package/dist/NodePath.js.map +1 -1
  15. package/dist/NodeRuntime.d.ts +33 -4
  16. package/dist/NodeRuntime.d.ts.map +1 -1
  17. package/dist/NodeRuntime.js +5 -1
  18. package/dist/NodeRuntime.js.map +1 -1
  19. package/dist/NodeSink.d.ts +33 -4
  20. package/dist/NodeSink.d.ts.map +1 -1
  21. package/dist/NodeSink.js +15 -3
  22. package/dist/NodeSink.js.map +1 -1
  23. package/dist/NodeSocket.d.ts +38 -7
  24. package/dist/NodeSocket.d.ts.map +1 -1
  25. package/dist/NodeSocket.js +23 -6
  26. package/dist/NodeSocket.js.map +1 -1
  27. package/dist/NodeSocketServer.d.ts +22 -5
  28. package/dist/NodeSocketServer.d.ts.map +1 -1
  29. package/dist/NodeSocketServer.js +22 -5
  30. package/dist/NodeSocketServer.js.map +1 -1
  31. package/dist/NodeStdio.d.ts +5 -1
  32. package/dist/NodeStdio.d.ts.map +1 -1
  33. package/dist/NodeStdio.js +22 -2
  34. package/dist/NodeStdio.js.map +1 -1
  35. package/dist/NodeStream.d.ts +79 -15
  36. package/dist/NodeStream.d.ts.map +1 -1
  37. package/dist/NodeStream.js +63 -11
  38. package/dist/NodeStream.js.map +1 -1
  39. package/dist/NodeTerminal.d.ts +9 -2
  40. package/dist/NodeTerminal.d.ts.map +1 -1
  41. package/dist/NodeTerminal.js +11 -2
  42. package/dist/NodeTerminal.js.map +1 -1
  43. package/package.json +5 -5
  44. package/src/NodeChildProcessSpawner.ts +3 -3
  45. package/src/NodeClusterSocket.ts +27 -3
  46. package/src/NodeFileSystem.ts +23 -2
  47. package/src/NodePath.ts +27 -4
  48. package/src/NodeRuntime.ts +33 -4
  49. package/src/NodeSink.ts +33 -4
  50. package/src/NodeSocket.ts +38 -7
  51. package/src/NodeSocketServer.ts +40 -6
  52. package/src/NodeStdio.ts +22 -2
  53. package/src/NodeStream.ts +79 -15
  54. package/src/NodeTerminal.ts +29 -3
package/src/NodeSocket.ts CHANGED
@@ -1,5 +1,19 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Shared Node socket constructors for adapting `node:net` connections and
3
+ * other Node `Duplex` streams to Effect's `Socket.Socket` interface.
4
+ *
5
+ * Use this module when building TCP clients, Unix domain socket clients, or
6
+ * higher-level protocols that already expose a Node `Duplex`. Connections are
7
+ * scoped, so finalizers close or destroy the underlying stream, open timeouts
8
+ * are reported as socket open errors, and Node read, write, and close events
9
+ * are translated into `SocketError` values.
10
+ *
11
+ * Node sockets have a few operational details worth keeping in mind: Unix
12
+ * socket paths are supplied through `NetConnectOpts.path`, writes complete only
13
+ * after Node accepts or flushes the chunk, and abnormal close events are
14
+ * surfaced as close errors while normal remote ends complete the socket run.
15
+ *
16
+ * @since 4.0.0
3
17
  */
4
18
  import type { Array } from "effect"
5
19
  import * as Channel from "effect/Channel"
@@ -18,22 +32,29 @@ import * as Net from "node:net"
18
32
  import type { Duplex } from "node:stream"
19
33
 
20
34
  /**
21
- * @since 1.0.0
22
35
  * @category re-exports
36
+ * @since 4.0.0
23
37
  */
24
38
  export * as NodeWS from "ws"
25
39
 
26
40
  /**
27
- * @since 1.0.0
41
+ * Service tag for the underlying Node `net.Socket` associated with the current
42
+ * socket connection.
43
+ *
28
44
  * @category tags
45
+ * @since 4.0.0
29
46
  */
30
47
  export class NetSocket extends Context.Service<NetSocket, Net.Socket>()(
31
48
  "@effect/platform-node/NodeSocket/NetSocket"
32
49
  ) {}
33
50
 
34
51
  /**
35
- * @since 1.0.0
52
+ * Opens a TCP connection with Node `net.createConnection` and exposes it as a
53
+ * `Socket.Socket`, supporting `openTimeout` and closing or destroying the
54
+ * socket when the enclosing scope is finalized.
55
+ *
36
56
  * @category constructors
57
+ * @since 4.0.0
37
58
  */
38
59
  export const makeNet = (
39
60
  options: Net.NetConnectOpts & {
@@ -77,8 +98,12 @@ export const makeNet = (
77
98
  )
78
99
 
79
100
  /**
80
- * @since 1.0.0
101
+ * Adapts a Node `Duplex` into a `Socket.Socket`, wiring data events to socket
102
+ * handlers, providing a scoped writer, and mapping open, read, write, and close
103
+ * failures to `SocketError`.
104
+ *
81
105
  * @category constructors
106
+ * @since 4.0.0
82
107
  */
83
108
  export const fromDuplex = <RO>(
84
109
  open: Effect.Effect<Duplex, Socket.SocketError, RO>,
@@ -212,8 +237,11 @@ export const fromDuplex = <RO>(
212
237
  })
213
238
 
214
239
  /**
215
- * @since 1.0.0
240
+ * Creates a `Channel` over a TCP socket, reading arrays of `Uint8Array`
241
+ * chunks and writing arrays of bytes, strings, or socket close events.
242
+ *
216
243
  * @category constructors
244
+ * @since 4.0.0
217
245
  */
218
246
  export const makeNetChannel = <IE = never>(
219
247
  options: Net.NetConnectOpts
@@ -229,8 +257,11 @@ export const makeNetChannel = <IE = never>(
229
257
  )
230
258
 
231
259
  /**
232
- * @since 1.0.0
260
+ * Provides a `Socket.Socket` by opening a TCP connection with the supplied
261
+ * Node `net` connection options.
262
+ *
233
263
  * @category layers
264
+ * @since 4.0.0
234
265
  */
235
266
  export const layerNet: (options: Net.NetConnectOpts) => Layer.Layer<
236
267
  Socket.Socket,
@@ -1,5 +1,22 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Shared Node socket server constructors for exposing `node:net` servers and
3
+ * `ws` WebSocket servers as Effect `SocketServer.SocketServer` services.
4
+ *
5
+ * Use this module when implementing TCP services, Unix domain socket services,
6
+ * WebSocket endpoints, or higher-level protocols such as RPC transports that
7
+ * need to accept incoming connections through Effect's socket APIs. TCP
8
+ * connections are adapted through `NodeSocket.fromDuplex`, while WebSocket
9
+ * handlers also receive the underlying `WebSocket` and Node `IncomingMessage`
10
+ * in their fiber context.
11
+ *
12
+ * The server starts listening before the constructor returns, and the exported
13
+ * `address` is derived from the actual Node server after binding. Prefer that
14
+ * address when using port `0`, wildcard hosts, or Unix socket paths. Incoming
15
+ * connections accepted before `run` is installed are queued and then handed to
16
+ * the handler, each `run` call owns the scope for its connection fibers, and
17
+ * the enclosing scope closes the underlying Node server.
18
+ *
19
+ * @since 4.0.0
3
20
  */
4
21
  import type { Cause } from "effect/Cause"
5
22
  import * as Context from "effect/Context"
@@ -20,8 +37,11 @@ import * as NodeSocket from "./NodeSocket.ts"
20
37
  import { NodeWS } from "./NodeSocket.ts"
21
38
 
22
39
  /**
23
- * @since 1.0.0
40
+ * Service tag for the Node `IncomingMessage` associated with the current
41
+ * WebSocket server connection.
42
+ *
24
43
  * @category tags
44
+ * @since 4.0.0
25
45
  */
26
46
  export class IncomingMessage extends Context.Service<
27
47
  IncomingMessage,
@@ -29,8 +49,12 @@ export class IncomingMessage extends Context.Service<
29
49
  >()("@effect/platform-node-shared/NodeSocketServer/IncomingMessage") {}
30
50
 
31
51
  /**
32
- * @since 1.0.0
52
+ * Creates a scoped TCP `SocketServer` from a Node `net.Server`, starts
53
+ * listening with the supplied options, queues pending connections until `run`
54
+ * is called, and closes the server when the scope ends.
55
+ *
33
56
  * @category constructors
57
+ * @since 4.0.0
34
58
  */
35
59
  export const make = Effect.fnUntraced(function*(
36
60
  options: Net.ServerOpts & Net.ListenOptions
@@ -144,8 +168,11 @@ export const make = Effect.fnUntraced(function*(
144
168
  })
145
169
 
146
170
  /**
147
- * @since 1.0.0
171
+ * Provides a TCP `SocketServer` by creating and managing a scoped Node
172
+ * `net.Server` with the supplied server and listen options.
173
+ *
148
174
  * @category layers
175
+ * @since 4.0.0
149
176
  */
150
177
  export const layer: (
151
178
  options: Net.ServerOpts & Net.ListenOptions
@@ -155,8 +182,12 @@ export const layer: (
155
182
  > = Function.flow(make, Layer.effect(SocketServer.SocketServer))
156
183
 
157
184
  /**
158
- * @since 1.0.0
185
+ * Creates a scoped WebSocket `SocketServer` backed by the `ws` package,
186
+ * providing the WebSocket and its Node `IncomingMessage` to connection
187
+ * handlers and closing the server when the scope ends.
188
+ *
159
189
  * @category constructors
190
+ * @since 4.0.0
160
191
  */
161
192
  export const makeWebSocket: (
162
193
  options: NodeWS.ServerOptions<typeof NodeWS.WebSocket, typeof Http.IncomingMessage>
@@ -255,8 +286,11 @@ export const makeWebSocket: (
255
286
  })
256
287
 
257
288
  /**
258
- * @since 1.0.0
289
+ * Provides a WebSocket `SocketServer` backed by the `ws` package and managed
290
+ * with the supplied server options.
291
+ *
259
292
  * @category layers
293
+ * @since 4.0.0
260
294
  */
261
295
  export const layerWebSocket: (
262
296
  options: NodeSocket.NodeWS.ServerOptions<typeof NodeSocket.NodeWS.WebSocket, typeof Http.IncomingMessage>
package/src/NodeStdio.ts CHANGED
@@ -1,5 +1,21 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Shared Node.js implementation of the Effect `Stdio` service.
3
+ *
4
+ * This module builds the `Stdio` layer used by Node platform packages by
5
+ * wiring the service to the current process: command-line arguments come from
6
+ * `process.argv`, input is read from `process.stdin`, and output and error
7
+ * output are written to `process.stdout` and `process.stderr`. It is intended
8
+ * for CLIs, scripts, command runners, test harnesses, and other
9
+ * process-oriented programs that need standard I/O through Effect services.
10
+ *
11
+ * The process stdio streams are global resources owned by Node. This layer
12
+ * leaves stdin open and does not end stdout or stderr by default, avoiding
13
+ * accidental closure of handles other code in the process may still use. Those
14
+ * streams may be pipes, files, or TTYs; interactive terminal behavior such as
15
+ * raw mode, echo, colors, and cursor movement should be coordinated with the
16
+ * terminal APIs instead of assuming this layer has exclusive control.
17
+ *
18
+ * @since 4.0.0
3
19
  */
4
20
  import * as Effect from "effect/Effect"
5
21
  import * as Layer from "effect/Layer"
@@ -9,8 +25,12 @@ import { fromWritable } from "./NodeSink.ts"
9
25
  import { fromReadable } from "./NodeStream.ts"
10
26
 
11
27
  /**
28
+ * Provides `Stdio` from `process.argv`, `process.stdin`, `process.stdout`,
29
+ * and `process.stderr`; stdin remains open and stdout/stderr are not ended by
30
+ * default.
31
+ *
12
32
  * @category Layers
13
- * @since 1.0.0
33
+ * @since 4.0.0
14
34
  */
15
35
  export const layer: Layer.Layer<Stdio.Stdio> = Layer.succeed(
16
36
  Stdio.Stdio,
package/src/NodeStream.ts CHANGED
@@ -1,5 +1,21 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Interoperability between Node streams and Effect streams and channels.
3
+ *
4
+ * This module adapts `Readable` and `Duplex` instances at the boundary with
5
+ * Node APIs: wrapping sources such as files, HTTP responses, child process
6
+ * output, and compression transforms as Effect `Stream`s or `Channel`s, piping
7
+ * Effect streams through Node duplex transforms, exposing an Effect `Stream`
8
+ * back to Node as a `Readable`, and collecting small readable payloads into
9
+ * strings or binary buffers.
10
+ *
11
+ * The adapters preserve the Node stream semantics that matter for production
12
+ * code. Writes wait for `drain` when a writable side applies backpressure,
13
+ * readable streams are destroyed on scope finalization by default, and stream
14
+ * failures are routed through `onError` or `Cause.UnknownError`. For long-lived
15
+ * or externally owned streams, pass `closeOnDone` or `endOnDone` carefully, and
16
+ * use `maxBytes` on collection helpers to avoid buffering unbounded input.
17
+ *
18
+ * @since 4.0.0
3
19
  */
4
20
  import * as Arr from "effect/Array"
5
21
  import * as Cause from "effect/Cause"
@@ -20,8 +36,12 @@ import { Readable } from "node:stream"
20
36
  import { pullIntoWritable } from "./NodeSink.ts"
21
37
 
22
38
  /**
39
+ * Converts a Node readable stream into an Effect `Stream`, reading chunks with
40
+ * an optional chunk size, mapping stream errors with `onError`, and destroying
41
+ * the readable on completion unless `closeOnDone` is `false`.
42
+ *
23
43
  * @category constructors
24
- * @since 1.0.0
44
+ * @since 4.0.0
25
45
  */
26
46
  export const fromReadable = <A = Uint8Array, E = Cause.UnknownError>(options: {
27
47
  readonly evaluate: LazyArg<Readable | NodeJS.ReadableStream>
@@ -32,8 +52,12 @@ export const fromReadable = <A = Uint8Array, E = Cause.UnknownError>(options: {
32
52
  }): Stream.Stream<A, E> => Stream.fromChannel(fromReadableChannel<A, E>(options))
33
53
 
34
54
  /**
55
+ * Creates a `Channel` that pulls chunks from a Node readable stream, mapping
56
+ * errors with `onError` and destroying the readable on completion unless
57
+ * `closeOnDone` is `false`.
58
+ *
35
59
  * @category constructors
36
- * @since 1.0.0
60
+ * @since 4.0.0
37
61
  */
38
62
  export const fromReadableChannel = <A = Uint8Array, E = Cause.UnknownError>(options: {
39
63
  readonly evaluate: LazyArg<Readable | NodeJS.ReadableStream>
@@ -52,8 +76,12 @@ export const fromReadableChannel = <A = Uint8Array, E = Cause.UnknownError>(opti
52
76
  )
53
77
 
54
78
  /**
79
+ * Creates a `Channel` over a Node `Duplex`, writing upstream chunks with
80
+ * backpressure while emitting chunks read from the duplex and optionally ending
81
+ * the writable side when upstream completes.
82
+ *
55
83
  * @category constructors
56
- * @since 1.0.0
84
+ * @since 4.0.0
57
85
  */
58
86
  export const fromDuplex = <IE, I = Uint8Array, O = Uint8Array, E = Cause.UnknownError>(
59
87
  options: {
@@ -95,13 +123,19 @@ export const fromDuplex = <IE, I = Uint8Array, O = Uint8Array, E = Cause.Unknown
95
123
  })
96
124
 
97
125
  /**
126
+ * Pipes an Effect `Stream` through a Node `Duplex`, writing the stream's
127
+ * chunks to the duplex and emitting chunks read back from it.
128
+ *
98
129
  * @category combinators
99
- * @since 1.0.0
130
+ * @since 4.0.0
100
131
  */
101
132
  export const pipeThroughDuplex: {
102
133
  /**
134
+ * Pipes an Effect `Stream` through a Node `Duplex`, writing the stream's
135
+ * chunks to the duplex and emitting chunks read back from it.
136
+ *
103
137
  * @category combinators
104
- * @since 1.0.0
138
+ * @since 4.0.0
105
139
  */
106
140
  <B = Uint8Array, E2 = Cause.UnknownError>(
107
141
  options: {
@@ -114,8 +148,11 @@ export const pipeThroughDuplex: {
114
148
  }
115
149
  ): <R, E, A>(self: Stream.Stream<A, E, R>) => Stream.Stream<B, E2 | E, R>
116
150
  /**
151
+ * Pipes an Effect `Stream` through a Node `Duplex`, writing the stream's
152
+ * chunks to the duplex and emitting chunks read back from it.
153
+ *
117
154
  * @category combinators
118
- * @since 1.0.0
155
+ * @since 4.0.0
119
156
  */
120
157
  <R, E, A, B = Uint8Array, E2 = Cause.UnknownError>(
121
158
  self: Stream.Stream<A, E, R>,
@@ -145,18 +182,27 @@ export const pipeThroughDuplex: {
145
182
  ))
146
183
 
147
184
  /**
185
+ * Pipes a stream of strings or bytes through a Node `Duplex` using default
186
+ * options and `Cause.UnknownError` for stream failures.
187
+ *
148
188
  * @category combinators
149
- * @since 1.0.0
189
+ * @since 4.0.0
150
190
  */
151
191
  export const pipeThroughSimple: {
152
192
  /**
193
+ * Pipes a stream of strings or bytes through a Node `Duplex` using default
194
+ * options and `Cause.UnknownError` for stream failures.
195
+ *
153
196
  * @category combinators
154
- * @since 1.0.0
197
+ * @since 4.0.0
155
198
  */
156
199
  (duplex: LazyArg<Duplex>): <R, E>(self: Stream.Stream<string | Uint8Array, E, R>) => Stream.Stream<Uint8Array, E | Cause.UnknownError, R>
157
200
  /**
201
+ * Pipes a stream of strings or bytes through a Node `Duplex` using default
202
+ * options and `Cause.UnknownError` for stream failures.
203
+ *
158
204
  * @category combinators
159
- * @since 1.0.0
205
+ * @since 4.0.0
160
206
  */
161
207
  <R, E>(self: Stream.Stream<string | Uint8Array, E, R>, duplex: LazyArg<Duplex>): Stream.Stream<Uint8Array, Cause.UnknownError | E, R>
162
208
  } = dual(2, <R, E>(
@@ -165,8 +211,12 @@ export const pipeThroughSimple: {
165
211
  ): Stream.Stream<Uint8Array, Cause.UnknownError | E, R> => pipeThroughDuplex(self, { evaluate: duplex }))
166
212
 
167
213
  /**
168
- * @since 1.0.0
214
+ * Converts an Effect `Stream` into a Node `Readable`, using the caller's
215
+ * Effect context to run the stream and destroying the readable if the stream
216
+ * fails.
217
+ *
169
218
  * @category conversions
219
+ * @since 4.0.0
170
220
  */
171
221
  export const toReadable = <E, R>(stream: Stream.Stream<string | Uint8Array, E, R>): Effect.Effect<Readable, never, R> =>
172
222
  Effect.map(
@@ -175,8 +225,11 @@ export const toReadable = <E, R>(stream: Stream.Stream<string | Uint8Array, E, R
175
225
  )
176
226
 
177
227
  /**
178
- * @since 1.0.0
228
+ * Converts a service-free Effect `Stream` into a Node `Readable` using an
229
+ * empty Effect context.
230
+ *
179
231
  * @category conversions
232
+ * @since 4.0.0
180
233
  */
181
234
  export const toReadableNever = <E>(stream: Stream.Stream<string | Uint8Array, E, never>): Readable =>
182
235
  new StreamAdapter(
@@ -185,8 +238,12 @@ export const toReadableNever = <E>(stream: Stream.Stream<string | Uint8Array, E,
185
238
  )
186
239
 
187
240
  /**
188
- * @since 1.0.0
241
+ * Consumes a Node readable stream into a string using the selected encoding,
242
+ * failing through `onError` on stream errors or when `maxBytes` is exceeded
243
+ * and destroying the stream on interruption or failure.
244
+ *
189
245
  * @category conversions
246
+ * @since 4.0.0
190
247
  */
191
248
  export const toString = <E = Cause.UnknownError>(
192
249
  readable: LazyArg<Readable | NodeJS.ReadableStream>,
@@ -234,8 +291,12 @@ export const toString = <E = Cause.UnknownError>(
234
291
  }
235
292
 
236
293
  /**
237
- * @since 1.0.0
294
+ * Consumes a Node readable stream into an `ArrayBuffer`, failing through
295
+ * `onError` on stream errors or when `maxBytes` is exceeded and destroying the
296
+ * stream on interruption or failure.
297
+ *
238
298
  * @category conversions
299
+ * @since 4.0.0
239
300
  */
240
301
  export const toArrayBuffer = <E = Cause.UnknownError>(
241
302
  readable: LazyArg<Readable | NodeJS.ReadableStream>,
@@ -281,8 +342,11 @@ export const toArrayBuffer = <E = Cause.UnknownError>(
281
342
  }
282
343
 
283
344
  /**
284
- * @since 1.0.0
345
+ * Consumes a Node readable stream into a `Uint8Array`, using the same error
346
+ * mapping and `maxBytes` handling as `toArrayBuffer`.
347
+ *
285
348
  * @category conversions
349
+ * @since 4.0.0
286
350
  */
287
351
  export const toUint8Array = <E = Cause.UnknownError>(
288
352
  readable: LazyArg<Readable | NodeJS.ReadableStream>,
@@ -1,5 +1,22 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Shared Node.js implementation of Effect's `Terminal` service.
3
+ *
4
+ * This module is the process-backed terminal implementation used by Node
5
+ * platform packages. It adapts Node's `readline` APIs and the current
6
+ * process' `stdin` and `stdout` streams into a `Terminal`, making it suitable
7
+ * for CLIs, REPLs, prompts, full-screen terminal programs, and other
8
+ * command-line tools that need line input, keypress input, terminal
9
+ * dimensions, or prompt output.
10
+ *
11
+ * The implementation works with global process streams, so callers should
12
+ * acquire it with a scope or provide `layer` to ensure cleanup. When `stdin`
13
+ * is a TTY, raw mode is enabled while the scoped readline interface is active
14
+ * and restored on release; raw mode changes how keys are delivered and can
15
+ * affect other code reading stdin. In non-TTY environments such as pipes,
16
+ * redirected input, or CI, raw mode is unavailable, keypress behavior is
17
+ * limited, and stdout dimensions may be reported as zero.
18
+ *
19
+ * @since 4.0.0
3
20
  */
4
21
  import type * as Cause from "effect/Cause"
5
22
  import * as Effect from "effect/Effect"
@@ -14,8 +31,12 @@ import * as Terminal from "effect/Terminal"
14
31
  import * as readline from "node:readline"
15
32
 
16
33
  /**
17
- * @since 1.0.0
34
+ * Creates a scoped process-backed `Terminal` using Node `readline`, enabling
35
+ * TTY raw mode while in scope and using the supplied predicate to decide when
36
+ * key input should end.
37
+ *
18
38
  * @category constructors
39
+ * @since 4.0.0
19
40
  */
20
41
  export const make: (
21
42
  shouldQuit?: (input: Terminal.UserInput) => boolean
@@ -47,6 +68,7 @@ export const make: (
47
68
  })
48
69
 
49
70
  const columns = Effect.sync(() => stdout.columns ?? 0)
71
+ const rows = Effect.sync(() => stdout.rows ?? 0)
50
72
 
51
73
  const readInput = Effect.gen(function*() {
52
74
  yield* RcRef.get(rlRef)
@@ -94,6 +116,7 @@ export const make: (
94
116
 
95
117
  return Terminal.make({
96
118
  columns,
119
+ rows,
97
120
  readInput,
98
121
  readLine,
99
122
  display
@@ -102,8 +125,11 @@ export const make: (
102
125
  )
103
126
 
104
127
  /**
105
- * @since 1.0.0
128
+ * Provides the default process-backed `Terminal` service, ending key input on
129
+ * Ctrl+C or Ctrl+D.
130
+ *
106
131
  * @category layers
132
+ * @since 4.0.0
107
133
  */
108
134
  export const layer: Layer.Layer<Terminal.Terminal> = Layer.effect(Terminal.Terminal, make(defaultShouldQuit))
109
135