@effect/platform-node-shared 4.0.0-beta.70 → 4.0.0-beta.72

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 (57) hide show
  1. package/dist/NodeChildProcessSpawner.d.ts +16 -2
  2. package/dist/NodeChildProcessSpawner.d.ts.map +1 -1
  3. package/dist/NodeChildProcessSpawner.js +1 -1
  4. package/dist/NodeChildProcessSpawner.js.map +1 -1
  5. package/dist/NodeClusterSocket.d.ts.map +1 -1
  6. package/dist/NodeClusterSocket.js +27 -14
  7. package/dist/NodeClusterSocket.js.map +1 -1
  8. package/dist/NodeCrypto.d.ts +22 -2
  9. package/dist/NodeCrypto.d.ts.map +1 -1
  10. package/dist/NodeCrypto.js +22 -2
  11. package/dist/NodeCrypto.js.map +1 -1
  12. package/dist/NodeFileSystem.d.ts.map +1 -1
  13. package/dist/NodeFileSystem.js +25 -12
  14. package/dist/NodeFileSystem.js.map +1 -1
  15. package/dist/NodePath.d.ts.map +1 -1
  16. package/dist/NodePath.js +20 -11
  17. package/dist/NodePath.js.map +1 -1
  18. package/dist/NodeRuntime.d.ts +28 -16
  19. package/dist/NodeRuntime.d.ts.map +1 -1
  20. package/dist/NodeRuntime.js.map +1 -1
  21. package/dist/NodeSink.d.ts +36 -13
  22. package/dist/NodeSink.d.ts.map +1 -1
  23. package/dist/NodeSink.js +11 -3
  24. package/dist/NodeSink.js.map +1 -1
  25. package/dist/NodeSocket.d.ts +31 -14
  26. package/dist/NodeSocket.d.ts.map +1 -1
  27. package/dist/NodeSocket.js +10 -3
  28. package/dist/NodeSocket.js.map +1 -1
  29. package/dist/NodeSocketServer.d.ts.map +1 -1
  30. package/dist/NodeSocketServer.js.map +1 -1
  31. package/dist/NodeStdio.d.ts.map +1 -1
  32. package/dist/NodeStdio.js +27 -12
  33. package/dist/NodeStdio.js.map +1 -1
  34. package/dist/NodeStream.d.ts +24 -15
  35. package/dist/NodeStream.d.ts.map +1 -1
  36. package/dist/NodeStream.js +22 -13
  37. package/dist/NodeStream.js.map +1 -1
  38. package/dist/NodeTerminal.d.ts.map +1 -1
  39. package/dist/NodeTerminal.js.map +1 -1
  40. package/dist/index.d.ts +0 -168
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +0 -168
  43. package/dist/index.js.map +1 -1
  44. package/package.json +3 -3
  45. package/src/NodeChildProcessSpawner.ts +16 -2
  46. package/src/NodeClusterSocket.ts +27 -14
  47. package/src/NodeCrypto.ts +22 -2
  48. package/src/NodeFileSystem.ts +25 -12
  49. package/src/NodePath.ts +20 -11
  50. package/src/NodeRuntime.ts +26 -14
  51. package/src/NodeSink.ts +36 -13
  52. package/src/NodeSocket.ts +31 -14
  53. package/src/NodeSocketServer.ts +32 -14
  54. package/src/NodeStdio.ts +27 -12
  55. package/src/NodeStream.ts +22 -13
  56. package/src/NodeTerminal.ts +23 -10
  57. package/src/index.ts +0 -168
package/dist/index.d.ts CHANGED
@@ -2,218 +2,50 @@
2
2
  * @since 4.0.0
3
3
  */
4
4
  /**
5
- * Node.js implementation of `ChildProcessSpawner`.
6
- *
7
5
  * @since 4.0.0
8
6
  */
9
7
  export * as NodeChildProcessSpawner from "./NodeChildProcessSpawner.ts";
10
8
  /**
11
- * Node TCP socket integration for Effect Cluster runner communication.
12
- *
13
- * This module provides the shared Node layers used by socket-based cluster
14
- * transports: a client protocol that opens TCP sockets to runner addresses and
15
- * a socket server that listens for incoming runner RPC traffic. It is useful
16
- * when wiring Node or Node-compatible cluster runners, sharing the same socket
17
- * implementation across platform packages, or building tests and deployments
18
- * that need direct runner-to-runner RPC over TCP rather than HTTP.
19
- *
20
- * Cluster runners must advertise an address that peers can reach while the
21
- * server may listen on a different address via `runnerListenAddress`, which is
22
- * common behind containers, port mappings, or Kubernetes services. Serialization
23
- * is supplied by the surrounding layer, and gossip, shard discovery, health
24
- * checks, and storage-backed delivery are coordinated by the cluster services
25
- * that use this transport. Keep those responsibilities separate when debugging:
26
- * a reachable socket does not by itself guarantee that runner membership,
27
- * shard ownership, or persisted message notification is current.
28
- *
29
9
  * @since 4.0.0
30
10
  */
31
11
  export * as NodeClusterSocket from "./NodeClusterSocket.ts";
32
12
  /**
33
- * Node.js implementation of the Crypto service.
34
- *
35
13
  * @since 1.0.0
36
14
  */
37
15
  export * as NodeCrypto from "./NodeCrypto.ts";
38
16
  /**
39
- * Shared Node-compatible implementation of Effect's `FileSystem` service.
40
- *
41
- * This module adapts Node's `node:fs`, `node:os`, and `node:path` APIs into a
42
- * layer that can be provided to Effect programs running on Node-compatible
43
- * runtimes. It is used by platform packages to provide file and directory I/O,
44
- * permissions, links, metadata, temporary files and directories, and file
45
- * watching through the `FileSystem` service.
46
- *
47
- * Paths are passed to Node filesystem APIs, so relative paths are resolved by
48
- * the current working directory and platform path rules still apply. Node
49
- * filesystem failures are translated into `PlatformError` values, while invalid
50
- * arguments become `BadArgument` failures. Open files are scoped resources with
51
- * tracked read and write positions; append mode lets the operating system choose
52
- * the write offset. File watching is exposed as a stream and follows
53
- * `node:fs.watch` semantics unless a `WatchBackend` is provided, so recursive
54
- * support, event coalescing, and reported paths can vary by runtime and
55
- * platform.
56
- *
57
17
  * @since 4.0.0
58
18
  */
59
19
  export * as NodeFileSystem from "./NodeFileSystem.ts";
60
20
  /**
61
- * Shared Node-compatible implementation of Effect's `Path` service.
62
- *
63
- * This module adapts Node's `node:path` and `node:url` APIs into layers that
64
- * can be provided to Effect programs needing path manipulation, such as
65
- * resolving configuration files, building file system locations, parsing
66
- * names and extensions, or converting between file paths and `file:` URLs.
67
- *
68
- * The default layer follows the host platform semantics exposed by
69
- * `node:path`, while `layerPosix` and `layerWin32` provide stable POSIX or
70
- * Windows behavior regardless of the current runtime. Path operations are
71
- * syntactic and do not check whether files exist; separators, drive letters,
72
- * UNC paths, and URL encoding rules can also differ by platform. Invalid
73
- * file URL conversions are reported through `BadArgument`.
74
- *
75
21
  * @since 4.0.0
76
22
  */
77
23
  export * as NodePath from "./NodePath.ts";
78
24
  /**
79
- * Shared runtime helpers for running Effect programs as Node-compatible
80
- * process entry points.
81
- *
82
- * This module provides the common `runMain` implementation used by
83
- * Node-compatible platform packages. It is intended for CLIs, scripts,
84
- * workers, servers, and other process-oriented programs that should run an
85
- * Effect as their main fiber while still following Node process conventions.
86
- *
87
- * The runner installs `SIGINT` and `SIGTERM` handlers for the lifetime of the
88
- * main fiber, translating those process signals into fiber interruption so
89
- * Effect finalizers and the configured teardown can run. When the fiber exits,
90
- * the signal listeners are removed and teardown determines the exit code. Clean
91
- * success lets the Node event loop drain naturally instead of forcing
92
- * `process.exit(0)`, while signal-triggered or non-zero exits call
93
- * `process.exit` after teardown, so long-running resources should be modeled
94
- * in the Effect scope and finalized explicitly.
95
- *
96
25
  * @since 4.0.0
97
26
  */
98
27
  export * as NodeRuntime from "./NodeRuntime.ts";
99
28
  /**
100
- * Sink adapters for writing Effect stream chunks into Node writable streams.
101
- *
102
- * This module is used at the boundary where Effect `Stream`s or `Channel`s need
103
- * to push data into Node's writable side: file streams, HTTP request or
104
- * response bodies, process stdio, sockets, and transform inputs such as
105
- * compression or encryption streams. It exposes both a `Sink` constructor for
106
- * ordinary stream pipelines and lower-level `Channel` and pull helpers used by
107
- * other Node stream adapters.
108
- *
109
- * The implementation follows Node writable semantics. Chunks are written in
110
- * order; when `write` returns `false`, pulling pauses until `drain` so upstream
111
- * producers do not overrun the writable buffer. Writable `error` events are
112
- * mapped through `onError`, and the writable is ended and awaited via `finish`
113
- * when upstream completes unless `endOnDone` is `false`. Use `endOnDone: false`
114
- * for externally owned or long-lived writables, and make sure `onError` keeps
115
- * Node's untyped errors meaningful for the calling Effect workflow.
116
- *
117
29
  * @since 4.0.0
118
30
  */
119
31
  export * as NodeSink from "./NodeSink.ts";
120
32
  /**
121
- * Shared Node socket constructors for adapting `node:net` connections and
122
- * other Node `Duplex` streams to Effect's `Socket.Socket` interface.
123
- *
124
- * Use this module when building TCP clients, Unix domain socket clients, or
125
- * higher-level protocols that already expose a Node `Duplex`. Connections are
126
- * scoped, so finalizers close or destroy the underlying stream, open timeouts
127
- * are reported as socket open errors, and Node read, write, and close events
128
- * are translated into `SocketError` values.
129
- *
130
- * Node sockets have a few operational details worth keeping in mind: Unix
131
- * socket paths are supplied through `NetConnectOpts.path`, writes complete only
132
- * after Node accepts or flushes the chunk, and abnormal close events are
133
- * surfaced as close errors while normal remote ends complete the socket run.
134
- *
135
33
  * @since 4.0.0
136
34
  */
137
35
  export * as NodeSocket from "./NodeSocket.ts";
138
36
  /**
139
- * Shared Node socket server constructors for exposing `node:net` servers and
140
- * `ws` WebSocket servers as Effect `SocketServer.SocketServer` services.
141
- *
142
- * Use this module when implementing TCP services, Unix domain socket services,
143
- * WebSocket endpoints, or higher-level protocols such as RPC transports that
144
- * need to accept incoming connections through Effect's socket APIs. TCP
145
- * connections are adapted through `NodeSocket.fromDuplex`, while WebSocket
146
- * handlers also receive the underlying `WebSocket` and Node `IncomingMessage`
147
- * in their fiber context.
148
- *
149
- * The server starts listening before the constructor returns, and the exported
150
- * `address` is derived from the actual Node server after binding. Prefer that
151
- * address when using port `0`, wildcard hosts, or Unix socket paths. Incoming
152
- * connections accepted before `run` is installed are queued and then handed to
153
- * the handler, each `run` call owns the scope for its connection fibers, and
154
- * the enclosing scope closes the underlying Node server.
155
- *
156
37
  * @since 4.0.0
157
38
  */
158
39
  export * as NodeSocketServer from "./NodeSocketServer.ts";
159
40
  /**
160
- * Shared Node.js implementation of the Effect `Stdio` service.
161
- *
162
- * This module builds the `Stdio` layer used by Node platform packages by
163
- * wiring the service to the current process: command-line arguments come from
164
- * `process.argv`, input is read from `process.stdin`, and output and error
165
- * output are written to `process.stdout` and `process.stderr`. It is intended
166
- * for CLIs, scripts, command runners, test harnesses, and other
167
- * process-oriented programs that need standard I/O through Effect services.
168
- *
169
- * The process stdio streams are global resources owned by Node. This layer
170
- * leaves stdin open and does not end stdout or stderr by default, avoiding
171
- * accidental closure of handles other code in the process may still use. Those
172
- * streams may be pipes, files, or TTYs; interactive terminal behavior such as
173
- * raw mode, echo, colors, and cursor movement should be coordinated with the
174
- * terminal APIs instead of assuming this layer has exclusive control.
175
- *
176
41
  * @since 4.0.0
177
42
  */
178
43
  export * as NodeStdio from "./NodeStdio.ts";
179
44
  /**
180
- * Interoperability between Node streams and Effect streams and channels.
181
- *
182
- * This module adapts `Readable` and `Duplex` instances at the boundary with
183
- * Node APIs: wrapping sources such as files, HTTP responses, child process
184
- * output, and compression transforms as Effect `Stream`s or `Channel`s, piping
185
- * Effect streams through Node duplex transforms, exposing an Effect `Stream`
186
- * back to Node as a `Readable`, and collecting small readable payloads into
187
- * strings or binary buffers.
188
- *
189
- * The adapters preserve the Node stream semantics that matter for production
190
- * code. Writes wait for `drain` when a writable side applies backpressure,
191
- * readable streams are destroyed on scope finalization by default, and stream
192
- * failures are routed through `onError` or `Cause.UnknownError`. For long-lived
193
- * or externally owned streams, pass `closeOnDone` or `endOnDone` carefully, and
194
- * use `maxBytes` on collection helpers to avoid buffering unbounded input.
195
- *
196
45
  * @since 4.0.0
197
46
  */
198
47
  export * as NodeStream from "./NodeStream.ts";
199
48
  /**
200
- * Shared Node.js implementation of Effect's `Terminal` service.
201
- *
202
- * This module is the process-backed terminal implementation used by Node
203
- * platform packages. It adapts Node's `readline` APIs and the current
204
- * process' `stdin` and `stdout` streams into a `Terminal`, making it suitable
205
- * for CLIs, REPLs, prompts, full-screen terminal programs, and other
206
- * command-line tools that need line input, keypress input, terminal
207
- * dimensions, or prompt output.
208
- *
209
- * The implementation works with global process streams, so callers should
210
- * acquire it with a scope or provide `layer` to ensure cleanup. When `stdin`
211
- * is a TTY, raw mode is enabled while the scoped readline interface is active
212
- * and restored on release; raw mode changes how keys are delivered and can
213
- * affect other code reading stdin. In non-TTY environments such as pipes,
214
- * redirected input, or CI, raw mode is unavailable, keypress behavior is
215
- * limited, and stdout dimensions may be reported as zero.
216
- *
217
49
  * @since 4.0.0
218
50
  */
219
51
  export * as NodeTerminal from "./NodeTerminal.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;GAIG;AACH,OAAO,KAAK,uBAAuB,MAAM,8BAA8B,CAAA;AAEvE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA;AAE3D;;;;GAIG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AAErD;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAEzC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAEzC;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA;AAEzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAE3C;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,OAAO,KAAK,uBAAuB,MAAM,8BAA8B,CAAA;AAEvE;;GAEG;AACH,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA;AAE3D;;GAEG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C;;GAEG;AACH,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AAErD;;GAEG;AACH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAEzC;;GAEG;AACH,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAE/C;;GAEG;AACH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAEzC;;GAEG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C;;GAEG;AACH,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA;AAEzD;;GAEG;AACH,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAE3C;;GAEG;AACH,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C;;GAEG;AACH,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA"}
package/dist/index.js CHANGED
@@ -3,218 +3,50 @@
3
3
  */
4
4
  // @barrel: Auto-generated exports. Do not edit manually.
5
5
  /**
6
- * Node.js implementation of `ChildProcessSpawner`.
7
- *
8
6
  * @since 4.0.0
9
7
  */
10
8
  export * as NodeChildProcessSpawner from "./NodeChildProcessSpawner.js";
11
9
  /**
12
- * Node TCP socket integration for Effect Cluster runner communication.
13
- *
14
- * This module provides the shared Node layers used by socket-based cluster
15
- * transports: a client protocol that opens TCP sockets to runner addresses and
16
- * a socket server that listens for incoming runner RPC traffic. It is useful
17
- * when wiring Node or Node-compatible cluster runners, sharing the same socket
18
- * implementation across platform packages, or building tests and deployments
19
- * that need direct runner-to-runner RPC over TCP rather than HTTP.
20
- *
21
- * Cluster runners must advertise an address that peers can reach while the
22
- * server may listen on a different address via `runnerListenAddress`, which is
23
- * common behind containers, port mappings, or Kubernetes services. Serialization
24
- * is supplied by the surrounding layer, and gossip, shard discovery, health
25
- * checks, and storage-backed delivery are coordinated by the cluster services
26
- * that use this transport. Keep those responsibilities separate when debugging:
27
- * a reachable socket does not by itself guarantee that runner membership,
28
- * shard ownership, or persisted message notification is current.
29
- *
30
10
  * @since 4.0.0
31
11
  */
32
12
  export * as NodeClusterSocket from "./NodeClusterSocket.js";
33
13
  /**
34
- * Node.js implementation of the Crypto service.
35
- *
36
14
  * @since 1.0.0
37
15
  */
38
16
  export * as NodeCrypto from "./NodeCrypto.js";
39
17
  /**
40
- * Shared Node-compatible implementation of Effect's `FileSystem` service.
41
- *
42
- * This module adapts Node's `node:fs`, `node:os`, and `node:path` APIs into a
43
- * layer that can be provided to Effect programs running on Node-compatible
44
- * runtimes. It is used by platform packages to provide file and directory I/O,
45
- * permissions, links, metadata, temporary files and directories, and file
46
- * watching through the `FileSystem` service.
47
- *
48
- * Paths are passed to Node filesystem APIs, so relative paths are resolved by
49
- * the current working directory and platform path rules still apply. Node
50
- * filesystem failures are translated into `PlatformError` values, while invalid
51
- * arguments become `BadArgument` failures. Open files are scoped resources with
52
- * tracked read and write positions; append mode lets the operating system choose
53
- * the write offset. File watching is exposed as a stream and follows
54
- * `node:fs.watch` semantics unless a `WatchBackend` is provided, so recursive
55
- * support, event coalescing, and reported paths can vary by runtime and
56
- * platform.
57
- *
58
18
  * @since 4.0.0
59
19
  */
60
20
  export * as NodeFileSystem from "./NodeFileSystem.js";
61
21
  /**
62
- * Shared Node-compatible implementation of Effect's `Path` service.
63
- *
64
- * This module adapts Node's `node:path` and `node:url` APIs into layers that
65
- * can be provided to Effect programs needing path manipulation, such as
66
- * resolving configuration files, building file system locations, parsing
67
- * names and extensions, or converting between file paths and `file:` URLs.
68
- *
69
- * The default layer follows the host platform semantics exposed by
70
- * `node:path`, while `layerPosix` and `layerWin32` provide stable POSIX or
71
- * Windows behavior regardless of the current runtime. Path operations are
72
- * syntactic and do not check whether files exist; separators, drive letters,
73
- * UNC paths, and URL encoding rules can also differ by platform. Invalid
74
- * file URL conversions are reported through `BadArgument`.
75
- *
76
22
  * @since 4.0.0
77
23
  */
78
24
  export * as NodePath from "./NodePath.js";
79
25
  /**
80
- * Shared runtime helpers for running Effect programs as Node-compatible
81
- * process entry points.
82
- *
83
- * This module provides the common `runMain` implementation used by
84
- * Node-compatible platform packages. It is intended for CLIs, scripts,
85
- * workers, servers, and other process-oriented programs that should run an
86
- * Effect as their main fiber while still following Node process conventions.
87
- *
88
- * The runner installs `SIGINT` and `SIGTERM` handlers for the lifetime of the
89
- * main fiber, translating those process signals into fiber interruption so
90
- * Effect finalizers and the configured teardown can run. When the fiber exits,
91
- * the signal listeners are removed and teardown determines the exit code. Clean
92
- * success lets the Node event loop drain naturally instead of forcing
93
- * `process.exit(0)`, while signal-triggered or non-zero exits call
94
- * `process.exit` after teardown, so long-running resources should be modeled
95
- * in the Effect scope and finalized explicitly.
96
- *
97
26
  * @since 4.0.0
98
27
  */
99
28
  export * as NodeRuntime from "./NodeRuntime.js";
100
29
  /**
101
- * Sink adapters for writing Effect stream chunks into Node writable streams.
102
- *
103
- * This module is used at the boundary where Effect `Stream`s or `Channel`s need
104
- * to push data into Node's writable side: file streams, HTTP request or
105
- * response bodies, process stdio, sockets, and transform inputs such as
106
- * compression or encryption streams. It exposes both a `Sink` constructor for
107
- * ordinary stream pipelines and lower-level `Channel` and pull helpers used by
108
- * other Node stream adapters.
109
- *
110
- * The implementation follows Node writable semantics. Chunks are written in
111
- * order; when `write` returns `false`, pulling pauses until `drain` so upstream
112
- * producers do not overrun the writable buffer. Writable `error` events are
113
- * mapped through `onError`, and the writable is ended and awaited via `finish`
114
- * when upstream completes unless `endOnDone` is `false`. Use `endOnDone: false`
115
- * for externally owned or long-lived writables, and make sure `onError` keeps
116
- * Node's untyped errors meaningful for the calling Effect workflow.
117
- *
118
30
  * @since 4.0.0
119
31
  */
120
32
  export * as NodeSink from "./NodeSink.js";
121
33
  /**
122
- * Shared Node socket constructors for adapting `node:net` connections and
123
- * other Node `Duplex` streams to Effect's `Socket.Socket` interface.
124
- *
125
- * Use this module when building TCP clients, Unix domain socket clients, or
126
- * higher-level protocols that already expose a Node `Duplex`. Connections are
127
- * scoped, so finalizers close or destroy the underlying stream, open timeouts
128
- * are reported as socket open errors, and Node read, write, and close events
129
- * are translated into `SocketError` values.
130
- *
131
- * Node sockets have a few operational details worth keeping in mind: Unix
132
- * socket paths are supplied through `NetConnectOpts.path`, writes complete only
133
- * after Node accepts or flushes the chunk, and abnormal close events are
134
- * surfaced as close errors while normal remote ends complete the socket run.
135
- *
136
34
  * @since 4.0.0
137
35
  */
138
36
  export * as NodeSocket from "./NodeSocket.js";
139
37
  /**
140
- * Shared Node socket server constructors for exposing `node:net` servers and
141
- * `ws` WebSocket servers as Effect `SocketServer.SocketServer` services.
142
- *
143
- * Use this module when implementing TCP services, Unix domain socket services,
144
- * WebSocket endpoints, or higher-level protocols such as RPC transports that
145
- * need to accept incoming connections through Effect's socket APIs. TCP
146
- * connections are adapted through `NodeSocket.fromDuplex`, while WebSocket
147
- * handlers also receive the underlying `WebSocket` and Node `IncomingMessage`
148
- * in their fiber context.
149
- *
150
- * The server starts listening before the constructor returns, and the exported
151
- * `address` is derived from the actual Node server after binding. Prefer that
152
- * address when using port `0`, wildcard hosts, or Unix socket paths. Incoming
153
- * connections accepted before `run` is installed are queued and then handed to
154
- * the handler, each `run` call owns the scope for its connection fibers, and
155
- * the enclosing scope closes the underlying Node server.
156
- *
157
38
  * @since 4.0.0
158
39
  */
159
40
  export * as NodeSocketServer from "./NodeSocketServer.js";
160
41
  /**
161
- * Shared Node.js implementation of the Effect `Stdio` service.
162
- *
163
- * This module builds the `Stdio` layer used by Node platform packages by
164
- * wiring the service to the current process: command-line arguments come from
165
- * `process.argv`, input is read from `process.stdin`, and output and error
166
- * output are written to `process.stdout` and `process.stderr`. It is intended
167
- * for CLIs, scripts, command runners, test harnesses, and other
168
- * process-oriented programs that need standard I/O through Effect services.
169
- *
170
- * The process stdio streams are global resources owned by Node. This layer
171
- * leaves stdin open and does not end stdout or stderr by default, avoiding
172
- * accidental closure of handles other code in the process may still use. Those
173
- * streams may be pipes, files, or TTYs; interactive terminal behavior such as
174
- * raw mode, echo, colors, and cursor movement should be coordinated with the
175
- * terminal APIs instead of assuming this layer has exclusive control.
176
- *
177
42
  * @since 4.0.0
178
43
  */
179
44
  export * as NodeStdio from "./NodeStdio.js";
180
45
  /**
181
- * Interoperability between Node streams and Effect streams and channels.
182
- *
183
- * This module adapts `Readable` and `Duplex` instances at the boundary with
184
- * Node APIs: wrapping sources such as files, HTTP responses, child process
185
- * output, and compression transforms as Effect `Stream`s or `Channel`s, piping
186
- * Effect streams through Node duplex transforms, exposing an Effect `Stream`
187
- * back to Node as a `Readable`, and collecting small readable payloads into
188
- * strings or binary buffers.
189
- *
190
- * The adapters preserve the Node stream semantics that matter for production
191
- * code. Writes wait for `drain` when a writable side applies backpressure,
192
- * readable streams are destroyed on scope finalization by default, and stream
193
- * failures are routed through `onError` or `Cause.UnknownError`. For long-lived
194
- * or externally owned streams, pass `closeOnDone` or `endOnDone` carefully, and
195
- * use `maxBytes` on collection helpers to avoid buffering unbounded input.
196
- *
197
46
  * @since 4.0.0
198
47
  */
199
48
  export * as NodeStream from "./NodeStream.js";
200
49
  /**
201
- * Shared Node.js implementation of Effect's `Terminal` service.
202
- *
203
- * This module is the process-backed terminal implementation used by Node
204
- * platform packages. It adapts Node's `readline` APIs and the current
205
- * process' `stdin` and `stdout` streams into a `Terminal`, making it suitable
206
- * for CLIs, REPLs, prompts, full-screen terminal programs, and other
207
- * command-line tools that need line input, keypress input, terminal
208
- * dimensions, or prompt output.
209
- *
210
- * The implementation works with global process streams, so callers should
211
- * acquire it with a scope or provide `layer` to ensure cleanup. When `stdin`
212
- * is a TTY, raw mode is enabled while the scoped readline interface is active
213
- * and restored on release; raw mode changes how keys are delivered and can
214
- * affect other code reading stdin. In non-TTY environments such as pipes,
215
- * redirected input, or CI, raw mode is unavailable, keypress behavior is
216
- * limited, and stdout dimensions may be reported as zero.
217
- *
218
50
  * @since 4.0.0
219
51
  */
220
52
  export * as NodeTerminal from "./NodeTerminal.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["NodeChildProcessSpawner","NodeClusterSocket","NodeCrypto","NodeFileSystem","NodePath","NodeRuntime","NodeSink","NodeSocket","NodeSocketServer","NodeStdio","NodeStream","NodeTerminal"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAIA;AAEA;;;;;AAKA,OAAO,KAAKA,uBAAuB,MAAM,8BAA8B;AAEvE;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAO,KAAKC,iBAAiB,MAAM,wBAAwB;AAE3D;;;;;AAKA,OAAO,KAAKC,UAAU,MAAM,iBAAiB;AAE7C;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAO,KAAKC,cAAc,MAAM,qBAAqB;AAErD;;;;;;;;;;;;;;;;;AAiBA,OAAO,KAAKC,QAAQ,MAAM,eAAe;AAEzC;;;;;;;;;;;;;;;;;;;;AAoBA,OAAO,KAAKC,WAAW,MAAM,kBAAkB;AAE/C;;;;;;;;;;;;;;;;;;;;AAoBA,OAAO,KAAKC,QAAQ,MAAM,eAAe;AAEzC;;;;;;;;;;;;;;;;;AAiBA,OAAO,KAAKC,UAAU,MAAM,iBAAiB;AAE7C;;;;;;;;;;;;;;;;;;;;AAoBA,OAAO,KAAKC,gBAAgB,MAAM,uBAAuB;AAEzD;;;;;;;;;;;;;;;;;;;AAmBA,OAAO,KAAKC,SAAS,MAAM,gBAAgB;AAE3C;;;;;;;;;;;;;;;;;;;AAmBA,OAAO,KAAKC,UAAU,MAAM,iBAAiB;AAE7C;;;;;;;;;;;;;;;;;;;;AAoBA,OAAO,KAAKC,YAAY,MAAM,mBAAmB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["NodeChildProcessSpawner","NodeClusterSocket","NodeCrypto","NodeFileSystem","NodePath","NodeRuntime","NodeSink","NodeSocket","NodeSocketServer","NodeStdio","NodeStream","NodeTerminal"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAIA;AAEA;;;AAGA,OAAO,KAAKA,uBAAuB,MAAM,8BAA8B;AAEvE;;;AAGA,OAAO,KAAKC,iBAAiB,MAAM,wBAAwB;AAE3D;;;AAGA,OAAO,KAAKC,UAAU,MAAM,iBAAiB;AAE7C;;;AAGA,OAAO,KAAKC,cAAc,MAAM,qBAAqB;AAErD;;;AAGA,OAAO,KAAKC,QAAQ,MAAM,eAAe;AAEzC;;;AAGA,OAAO,KAAKC,WAAW,MAAM,kBAAkB;AAE/C;;;AAGA,OAAO,KAAKC,QAAQ,MAAM,eAAe;AAEzC;;;AAGA,OAAO,KAAKC,UAAU,MAAM,iBAAiB;AAE7C;;;AAGA,OAAO,KAAKC,gBAAgB,MAAM,uBAAuB;AAEzD;;;AAGA,OAAO,KAAKC,SAAS,MAAM,gBAAgB;AAE3C;;;AAGA,OAAO,KAAKC,UAAU,MAAM,iBAAiB;AAE7C;;;AAGA,OAAO,KAAKC,YAAY,MAAM,mBAAmB","ignoreList":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@effect/platform-node-shared",
3
3
  "type": "module",
4
- "version": "4.0.0-beta.70",
4
+ "version": "4.0.0-beta.72",
5
5
  "license": "MIT",
6
6
  "description": "Unified interfaces for common platform-specific services",
7
7
  "homepage": "https://effect.website",
@@ -46,12 +46,12 @@
46
46
  "provenance": true
47
47
  },
48
48
  "peerDependencies": {
49
- "effect": "^4.0.0-beta.70"
49
+ "effect": "^4.0.0-beta.72"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/node": "^25.7.0",
53
53
  "tar": "^7.5.15",
54
- "effect": "^4.0.0-beta.70"
54
+ "effect": "^4.0.0-beta.72"
55
55
  },
56
56
  "dependencies": {
57
57
  "@types/ws": "^8.18.1",
@@ -1,5 +1,19 @@
1
1
  /**
2
- * Node.js implementation of `ChildProcessSpawner`.
2
+ * Shared Node.js implementation of the child process spawner service.
3
+ *
4
+ * This module adapts `node:child_process.spawn` to the Effect
5
+ * `ChildProcessSpawner` service. Provide {@link layer} to run `ChildProcess`
6
+ * commands in Node-compatible runtimes: commands get scoped process handles
7
+ * with stdin sinks, stdout and stderr streams, exit-code waiting,
8
+ * interruption-time cleanup, process killing, and custom file-descriptor pipes.
9
+ *
10
+ * The implementation sits below the command-building API. It validates and
11
+ * resolves `cwd` through the Effect `FileSystem` and `Path` services,
12
+ * translates Node errno failures to `PlatformError`, and uses scopes to
13
+ * terminate referenced children when the owning effect is interrupted or
14
+ * finalized. Pipelines are flattened by {@link flattenCommand} and spawned one
15
+ * process at a time, wiring the selected source stream (`stdout`, `stderr`,
16
+ * `all`, or `fdN`) to the destination `stdin` or `fdN`.
3
17
  *
4
18
  * @since 4.0.0
5
19
  */
@@ -625,7 +639,7 @@ const make = Effect.gen(function*() {
625
639
  })
626
640
 
627
641
  /**
628
- * Layer providing the `NodeChildProcessSpawner` implementation.
642
+ * Layer that provides the `NodeChildProcessSpawner` implementation.
629
643
  *
630
644
  * @category layers
631
645
  * @since 4.0.0
@@ -1,21 +1,34 @@
1
1
  /**
2
- * Node TCP socket integration for Effect Cluster runner communication.
2
+ * Node TCP socket transport for Effect Cluster runner-to-runner RPC.
3
3
  *
4
4
  * This module provides the shared Node layers used by socket-based cluster
5
- * transports: a client protocol that opens TCP sockets to runner addresses and
6
- * a socket server that listens for incoming runner RPC traffic. It is useful
7
- * when wiring Node or Node-compatible cluster runners, sharing the same socket
8
- * implementation across platform packages, or building tests and deployments
9
- * that need direct runner-to-runner RPC over TCP rather than HTTP.
5
+ * transports. `layerClientProtocol` opens TCP sockets to peer runner addresses
6
+ * and wraps them in the current RPC serialization protocol. `layerSocketServer`
7
+ * exposes the socket server that receives incoming runner RPC traffic.
10
8
  *
11
- * Cluster runners must advertise an address that peers can reach while the
12
- * server may listen on a different address via `runnerListenAddress`, which is
13
- * common behind containers, port mappings, or Kubernetes services. Serialization
14
- * is supplied by the surrounding layer, and gossip, shard discovery, health
15
- * checks, and storage-backed delivery are coordinated by the cluster services
16
- * that use this transport. Keep those responsibilities separate when debugging:
17
- * a reachable socket does not by itself guarantee that runner membership,
18
- * shard ownership, or persisted message notification is current.
9
+ * **Mental model**
10
+ *
11
+ * The cluster runtime decides which runners exist, which shards they own, and
12
+ * which messages must be delivered. This module only provides the TCP transport
13
+ * those services use after a runner address has been selected. The client side
14
+ * dials an advertised runner address; the server side listens on the address
15
+ * configured for the local runner.
16
+ *
17
+ * **Common tasks**
18
+ *
19
+ * Add these layers when a Node or Node-compatible cluster deployment should use
20
+ * direct socket RPC instead of an HTTP transport. Configure `runnerAddress` as
21
+ * the address other runners can reach, and configure `runnerListenAddress` when
22
+ * the local process must bind a different host or port.
23
+ *
24
+ * **Gotchas**
25
+ *
26
+ * Containers, port mappings, and Kubernetes services often require different
27
+ * advertised and listening addresses. Serialization is provided by the
28
+ * surrounding layer, not by this module. A reachable socket confirms only that
29
+ * TCP transport is available; gossip, shard ownership, health checks, and
30
+ * persisted message notification are coordinated by the cluster services that
31
+ * use this transport.
19
32
  *
20
33
  * @since 4.0.0
21
34
  */
package/src/NodeCrypto.ts CHANGED
@@ -1,5 +1,25 @@
1
1
  /**
2
- * Node.js implementation of the Crypto service.
2
+ * The `NodeCrypto` module implements Effect's `Crypto` service with
3
+ * Node-compatible `node:crypto` APIs. It exports {@link make} as the concrete
4
+ * service value and {@link layer} for providing that service to programs that
5
+ * need cryptographic random bytes, UUID generation, random values, or SHA
6
+ * digests over `Uint8Array` input.
7
+ *
8
+ * **Common tasks**
9
+ *
10
+ * - Provide {@link layer} in Node-compatible platform packages and tests
11
+ * - Reuse {@link make} when a surrounding layer already manages service
12
+ * construction
13
+ * - Compute SHA-1, SHA-256, SHA-384, or SHA-512 digests through
14
+ * `effect/Crypto` after the layer is provided
15
+ *
16
+ * **Gotchas**
17
+ *
18
+ * - Random bytes come from `node:crypto.randomBytes`
19
+ * - Digests use `node:crypto.createHash`; hash failures become platform
20
+ * errors
21
+ * - SHA-1 is included for interoperability with existing protocols, not for
22
+ * new security-sensitive designs
3
23
  *
4
24
  * @since 1.0.0
5
25
  */
@@ -47,7 +67,7 @@ export const make: EffectCrypto.Crypto = EffectCrypto.make({
47
67
  })
48
68
 
49
69
  /**
50
- * A layer that provides the Node.js Crypto service implementation.
70
+ * Layer that provides the Node.js Crypto service implementation.
51
71
  *
52
72
  * @category layers
53
73
  * @since 1.0.0
@@ -2,19 +2,32 @@
2
2
  * Shared Node-compatible implementation of Effect's `FileSystem` service.
3
3
  *
4
4
  * This module adapts Node's `node:fs`, `node:os`, and `node:path` APIs into a
5
- * layer that can be provided to Effect programs running on Node-compatible
6
- * runtimes. It is used by platform packages to provide file and directory I/O,
7
- * permissions, links, metadata, temporary files and directories, and file
8
- * watching through the `FileSystem` service.
5
+ * `FileSystem` layer for Effect programs running on Node-compatible runtimes.
6
+ * Platform packages use it to provide file and directory I/O, permissions,
7
+ * links, metadata, temporary files and directories, and file watching through
8
+ * the shared `FileSystem` service.
9
9
  *
10
- * Paths are passed to Node filesystem APIs, so relative paths are resolved by
11
- * the current working directory and platform path rules still apply. Node
12
- * filesystem failures are translated into `PlatformError` values, while invalid
13
- * arguments become `BadArgument` failures. Open files are scoped resources with
14
- * tracked read and write positions; append mode lets the operating system choose
15
- * the write offset. File watching is exposed as a stream and follows
16
- * `node:fs.watch` semantics unless a `WatchBackend` is provided, so recursive
17
- * support, event coalescing, and reported paths can vary by runtime and
10
+ * **Mental model**
11
+ *
12
+ * {@link layer} installs a process-backed `FileSystem` service. Each operation
13
+ * delegates to the corresponding Node filesystem API, then maps Node failures
14
+ * into `PlatformError` values and invalid arguments into `BadArgument` failures.
15
+ * Paths keep Node's normal behavior: relative paths resolve from the current
16
+ * working directory and platform path rules still apply.
17
+ *
18
+ * **Common tasks**
19
+ *
20
+ * Provide {@link layer} at the Node runtime boundary, then depend on the
21
+ * `FileSystem` service from application code. Use the service for ordinary
22
+ * reads and writes, directory management, metadata inspection, links, temporary
23
+ * resources, and file watching without importing Node's `fs` APIs directly.
24
+ *
25
+ * **Gotchas**
26
+ *
27
+ * Open files are scoped resources with tracked read and write positions; append
28
+ * mode lets the operating system choose the write offset. File watching follows
29
+ * `node:fs.watch` semantics unless a custom watch backend is supplied, so
30
+ * recursive support, event coalescing, and reported paths vary by runtime and
18
31
  * platform.
19
32
  *
20
33
  * @since 4.0.0