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

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.
@@ -0,0 +1,220 @@
1
+ /**
2
+ * @since 4.0.0
3
+ */
4
+ /**
5
+ * Node.js implementation of `ChildProcessSpawner`.
6
+ *
7
+ * @since 4.0.0
8
+ */
9
+ export * as NodeChildProcessSpawner from "./NodeChildProcessSpawner.ts";
10
+ /**
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
+ * @since 4.0.0
30
+ */
31
+ export * as NodeClusterSocket from "./NodeClusterSocket.ts";
32
+ /**
33
+ * Node.js implementation of the Crypto service.
34
+ *
35
+ * @since 1.0.0
36
+ */
37
+ export * as NodeCrypto from "./NodeCrypto.ts";
38
+ /**
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
+ * @since 4.0.0
58
+ */
59
+ export * as NodeFileSystem from "./NodeFileSystem.ts";
60
+ /**
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
+ * @since 4.0.0
76
+ */
77
+ export * as NodePath from "./NodePath.ts";
78
+ /**
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
+ * @since 4.0.0
97
+ */
98
+ export * as NodeRuntime from "./NodeRuntime.ts";
99
+ /**
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
+ * @since 4.0.0
118
+ */
119
+ export * as NodeSink from "./NodeSink.ts";
120
+ /**
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
+ * @since 4.0.0
136
+ */
137
+ export * as NodeSocket from "./NodeSocket.ts";
138
+ /**
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
+ * @since 4.0.0
157
+ */
158
+ export * as NodeSocketServer from "./NodeSocketServer.ts";
159
+ /**
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
+ * @since 4.0.0
177
+ */
178
+ export * as NodeStdio from "./NodeStdio.ts";
179
+ /**
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
+ * @since 4.0.0
197
+ */
198
+ export * as NodeStream from "./NodeStream.ts";
199
+ /**
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
+ * @since 4.0.0
218
+ */
219
+ export * as NodeTerminal from "./NodeTerminal.ts";
220
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
package/dist/index.js ADDED
@@ -0,0 +1,221 @@
1
+ /**
2
+ * @since 4.0.0
3
+ */
4
+ // @barrel: Auto-generated exports. Do not edit manually.
5
+ /**
6
+ * Node.js implementation of `ChildProcessSpawner`.
7
+ *
8
+ * @since 4.0.0
9
+ */
10
+ export * as NodeChildProcessSpawner from "./NodeChildProcessSpawner.js";
11
+ /**
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
+ * @since 4.0.0
31
+ */
32
+ export * as NodeClusterSocket from "./NodeClusterSocket.js";
33
+ /**
34
+ * Node.js implementation of the Crypto service.
35
+ *
36
+ * @since 1.0.0
37
+ */
38
+ export * as NodeCrypto from "./NodeCrypto.js";
39
+ /**
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
+ * @since 4.0.0
59
+ */
60
+ export * as NodeFileSystem from "./NodeFileSystem.js";
61
+ /**
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
+ * @since 4.0.0
77
+ */
78
+ export * as NodePath from "./NodePath.js";
79
+ /**
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
+ * @since 4.0.0
98
+ */
99
+ export * as NodeRuntime from "./NodeRuntime.js";
100
+ /**
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
+ * @since 4.0.0
119
+ */
120
+ export * as NodeSink from "./NodeSink.js";
121
+ /**
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
+ * @since 4.0.0
137
+ */
138
+ export * as NodeSocket from "./NodeSocket.js";
139
+ /**
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
+ * @since 4.0.0
158
+ */
159
+ export * as NodeSocketServer from "./NodeSocketServer.js";
160
+ /**
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
+ * @since 4.0.0
178
+ */
179
+ export * as NodeStdio from "./NodeStdio.js";
180
+ /**
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
+ * @since 4.0.0
198
+ */
199
+ export * as NodeStream from "./NodeStream.js";
200
+ /**
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
+ * @since 4.0.0
219
+ */
220
+ export * as NodeTerminal from "./NodeTerminal.js";
221
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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":[]}
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.69",
4
+ "version": "4.0.0-beta.70",
5
5
  "license": "MIT",
6
6
  "description": "Unified interfaces for common platform-specific services",
7
7
  "homepage": "https://effect.website",
@@ -46,18 +46,19 @@
46
46
  "provenance": true
47
47
  },
48
48
  "peerDependencies": {
49
- "effect": "^4.0.0-beta.69"
49
+ "effect": "^4.0.0-beta.70"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/node": "^25.7.0",
53
53
  "tar": "^7.5.15",
54
- "effect": "^4.0.0-beta.69"
54
+ "effect": "^4.0.0-beta.70"
55
55
  },
56
56
  "dependencies": {
57
57
  "@types/ws": "^8.18.1",
58
58
  "ws": "^8.20.0"
59
59
  },
60
60
  "scripts": {
61
+ "codegen": "effect-utils codegen",
61
62
  "build": "tsc -b tsconfig.json && pnpm babel",
62
63
  "build:tsgo": "tsgo -b tsconfig.json && pnpm babel",
63
64
  "babel": "babel dist --plugins annotate-pure-calls --out-dir dist --source-maps",
package/src/index.ts ADDED
@@ -0,0 +1,233 @@
1
+ /**
2
+ * @since 4.0.0
3
+ */
4
+
5
+ // @barrel: Auto-generated exports. Do not edit manually.
6
+
7
+ /**
8
+ * Node.js implementation of `ChildProcessSpawner`.
9
+ *
10
+ * @since 4.0.0
11
+ */
12
+ export * as NodeChildProcessSpawner from "./NodeChildProcessSpawner.ts"
13
+
14
+ /**
15
+ * Node TCP socket integration for Effect Cluster runner communication.
16
+ *
17
+ * This module provides the shared Node layers used by socket-based cluster
18
+ * transports: a client protocol that opens TCP sockets to runner addresses and
19
+ * a socket server that listens for incoming runner RPC traffic. It is useful
20
+ * when wiring Node or Node-compatible cluster runners, sharing the same socket
21
+ * implementation across platform packages, or building tests and deployments
22
+ * that need direct runner-to-runner RPC over TCP rather than HTTP.
23
+ *
24
+ * Cluster runners must advertise an address that peers can reach while the
25
+ * server may listen on a different address via `runnerListenAddress`, which is
26
+ * common behind containers, port mappings, or Kubernetes services. Serialization
27
+ * is supplied by the surrounding layer, and gossip, shard discovery, health
28
+ * checks, and storage-backed delivery are coordinated by the cluster services
29
+ * that use this transport. Keep those responsibilities separate when debugging:
30
+ * a reachable socket does not by itself guarantee that runner membership,
31
+ * shard ownership, or persisted message notification is current.
32
+ *
33
+ * @since 4.0.0
34
+ */
35
+ export * as NodeClusterSocket from "./NodeClusterSocket.ts"
36
+
37
+ /**
38
+ * Node.js implementation of the Crypto service.
39
+ *
40
+ * @since 1.0.0
41
+ */
42
+ export * as NodeCrypto from "./NodeCrypto.ts"
43
+
44
+ /**
45
+ * Shared Node-compatible implementation of Effect's `FileSystem` service.
46
+ *
47
+ * This module adapts Node's `node:fs`, `node:os`, and `node:path` APIs into a
48
+ * layer that can be provided to Effect programs running on Node-compatible
49
+ * runtimes. It is used by platform packages to provide file and directory I/O,
50
+ * permissions, links, metadata, temporary files and directories, and file
51
+ * watching through the `FileSystem` service.
52
+ *
53
+ * Paths are passed to Node filesystem APIs, so relative paths are resolved by
54
+ * the current working directory and platform path rules still apply. Node
55
+ * filesystem failures are translated into `PlatformError` values, while invalid
56
+ * arguments become `BadArgument` failures. Open files are scoped resources with
57
+ * tracked read and write positions; append mode lets the operating system choose
58
+ * the write offset. File watching is exposed as a stream and follows
59
+ * `node:fs.watch` semantics unless a `WatchBackend` is provided, so recursive
60
+ * support, event coalescing, and reported paths can vary by runtime and
61
+ * platform.
62
+ *
63
+ * @since 4.0.0
64
+ */
65
+ export * as NodeFileSystem from "./NodeFileSystem.ts"
66
+
67
+ /**
68
+ * Shared Node-compatible implementation of Effect's `Path` service.
69
+ *
70
+ * This module adapts Node's `node:path` and `node:url` APIs into layers that
71
+ * can be provided to Effect programs needing path manipulation, such as
72
+ * resolving configuration files, building file system locations, parsing
73
+ * names and extensions, or converting between file paths and `file:` URLs.
74
+ *
75
+ * The default layer follows the host platform semantics exposed by
76
+ * `node:path`, while `layerPosix` and `layerWin32` provide stable POSIX or
77
+ * Windows behavior regardless of the current runtime. Path operations are
78
+ * syntactic and do not check whether files exist; separators, drive letters,
79
+ * UNC paths, and URL encoding rules can also differ by platform. Invalid
80
+ * file URL conversions are reported through `BadArgument`.
81
+ *
82
+ * @since 4.0.0
83
+ */
84
+ export * as NodePath from "./NodePath.ts"
85
+
86
+ /**
87
+ * Shared runtime helpers for running Effect programs as Node-compatible
88
+ * process entry points.
89
+ *
90
+ * This module provides the common `runMain` implementation used by
91
+ * Node-compatible platform packages. It is intended for CLIs, scripts,
92
+ * workers, servers, and other process-oriented programs that should run an
93
+ * Effect as their main fiber while still following Node process conventions.
94
+ *
95
+ * The runner installs `SIGINT` and `SIGTERM` handlers for the lifetime of the
96
+ * main fiber, translating those process signals into fiber interruption so
97
+ * Effect finalizers and the configured teardown can run. When the fiber exits,
98
+ * the signal listeners are removed and teardown determines the exit code. Clean
99
+ * success lets the Node event loop drain naturally instead of forcing
100
+ * `process.exit(0)`, while signal-triggered or non-zero exits call
101
+ * `process.exit` after teardown, so long-running resources should be modeled
102
+ * in the Effect scope and finalized explicitly.
103
+ *
104
+ * @since 4.0.0
105
+ */
106
+ export * as NodeRuntime from "./NodeRuntime.ts"
107
+
108
+ /**
109
+ * Sink adapters for writing Effect stream chunks into Node writable streams.
110
+ *
111
+ * This module is used at the boundary where Effect `Stream`s or `Channel`s need
112
+ * to push data into Node's writable side: file streams, HTTP request or
113
+ * response bodies, process stdio, sockets, and transform inputs such as
114
+ * compression or encryption streams. It exposes both a `Sink` constructor for
115
+ * ordinary stream pipelines and lower-level `Channel` and pull helpers used by
116
+ * other Node stream adapters.
117
+ *
118
+ * The implementation follows Node writable semantics. Chunks are written in
119
+ * order; when `write` returns `false`, pulling pauses until `drain` so upstream
120
+ * producers do not overrun the writable buffer. Writable `error` events are
121
+ * mapped through `onError`, and the writable is ended and awaited via `finish`
122
+ * when upstream completes unless `endOnDone` is `false`. Use `endOnDone: false`
123
+ * for externally owned or long-lived writables, and make sure `onError` keeps
124
+ * Node's untyped errors meaningful for the calling Effect workflow.
125
+ *
126
+ * @since 4.0.0
127
+ */
128
+ export * as NodeSink from "./NodeSink.ts"
129
+
130
+ /**
131
+ * Shared Node socket constructors for adapting `node:net` connections and
132
+ * other Node `Duplex` streams to Effect's `Socket.Socket` interface.
133
+ *
134
+ * Use this module when building TCP clients, Unix domain socket clients, or
135
+ * higher-level protocols that already expose a Node `Duplex`. Connections are
136
+ * scoped, so finalizers close or destroy the underlying stream, open timeouts
137
+ * are reported as socket open errors, and Node read, write, and close events
138
+ * are translated into `SocketError` values.
139
+ *
140
+ * Node sockets have a few operational details worth keeping in mind: Unix
141
+ * socket paths are supplied through `NetConnectOpts.path`, writes complete only
142
+ * after Node accepts or flushes the chunk, and abnormal close events are
143
+ * surfaced as close errors while normal remote ends complete the socket run.
144
+ *
145
+ * @since 4.0.0
146
+ */
147
+ export * as NodeSocket from "./NodeSocket.ts"
148
+
149
+ /**
150
+ * Shared Node socket server constructors for exposing `node:net` servers and
151
+ * `ws` WebSocket servers as Effect `SocketServer.SocketServer` services.
152
+ *
153
+ * Use this module when implementing TCP services, Unix domain socket services,
154
+ * WebSocket endpoints, or higher-level protocols such as RPC transports that
155
+ * need to accept incoming connections through Effect's socket APIs. TCP
156
+ * connections are adapted through `NodeSocket.fromDuplex`, while WebSocket
157
+ * handlers also receive the underlying `WebSocket` and Node `IncomingMessage`
158
+ * in their fiber context.
159
+ *
160
+ * The server starts listening before the constructor returns, and the exported
161
+ * `address` is derived from the actual Node server after binding. Prefer that
162
+ * address when using port `0`, wildcard hosts, or Unix socket paths. Incoming
163
+ * connections accepted before `run` is installed are queued and then handed to
164
+ * the handler, each `run` call owns the scope for its connection fibers, and
165
+ * the enclosing scope closes the underlying Node server.
166
+ *
167
+ * @since 4.0.0
168
+ */
169
+ export * as NodeSocketServer from "./NodeSocketServer.ts"
170
+
171
+ /**
172
+ * Shared Node.js implementation of the Effect `Stdio` service.
173
+ *
174
+ * This module builds the `Stdio` layer used by Node platform packages by
175
+ * wiring the service to the current process: command-line arguments come from
176
+ * `process.argv`, input is read from `process.stdin`, and output and error
177
+ * output are written to `process.stdout` and `process.stderr`. It is intended
178
+ * for CLIs, scripts, command runners, test harnesses, and other
179
+ * process-oriented programs that need standard I/O through Effect services.
180
+ *
181
+ * The process stdio streams are global resources owned by Node. This layer
182
+ * leaves stdin open and does not end stdout or stderr by default, avoiding
183
+ * accidental closure of handles other code in the process may still use. Those
184
+ * streams may be pipes, files, or TTYs; interactive terminal behavior such as
185
+ * raw mode, echo, colors, and cursor movement should be coordinated with the
186
+ * terminal APIs instead of assuming this layer has exclusive control.
187
+ *
188
+ * @since 4.0.0
189
+ */
190
+ export * as NodeStdio from "./NodeStdio.ts"
191
+
192
+ /**
193
+ * Interoperability between Node streams and Effect streams and channels.
194
+ *
195
+ * This module adapts `Readable` and `Duplex` instances at the boundary with
196
+ * Node APIs: wrapping sources such as files, HTTP responses, child process
197
+ * output, and compression transforms as Effect `Stream`s or `Channel`s, piping
198
+ * Effect streams through Node duplex transforms, exposing an Effect `Stream`
199
+ * back to Node as a `Readable`, and collecting small readable payloads into
200
+ * strings or binary buffers.
201
+ *
202
+ * The adapters preserve the Node stream semantics that matter for production
203
+ * code. Writes wait for `drain` when a writable side applies backpressure,
204
+ * readable streams are destroyed on scope finalization by default, and stream
205
+ * failures are routed through `onError` or `Cause.UnknownError`. For long-lived
206
+ * or externally owned streams, pass `closeOnDone` or `endOnDone` carefully, and
207
+ * use `maxBytes` on collection helpers to avoid buffering unbounded input.
208
+ *
209
+ * @since 4.0.0
210
+ */
211
+ export * as NodeStream from "./NodeStream.ts"
212
+
213
+ /**
214
+ * Shared Node.js implementation of Effect's `Terminal` service.
215
+ *
216
+ * This module is the process-backed terminal implementation used by Node
217
+ * platform packages. It adapts Node's `readline` APIs and the current
218
+ * process' `stdin` and `stdout` streams into a `Terminal`, making it suitable
219
+ * for CLIs, REPLs, prompts, full-screen terminal programs, and other
220
+ * command-line tools that need line input, keypress input, terminal
221
+ * dimensions, or prompt output.
222
+ *
223
+ * The implementation works with global process streams, so callers should
224
+ * acquire it with a scope or provide `layer` to ensure cleanup. When `stdin`
225
+ * is a TTY, raw mode is enabled while the scoped readline interface is active
226
+ * and restored on release; raw mode changes how keys are delivered and can
227
+ * affect other code reading stdin. In non-TTY environments such as pipes,
228
+ * redirected input, or CI, raw mode is unavailable, keypress behavior is
229
+ * limited, and stdout dimensions may be reported as zero.
230
+ *
231
+ * @since 4.0.0
232
+ */
233
+ export * as NodeTerminal from "./NodeTerminal.ts"