@effect/platform-bun 4.0.0-beta.78 → 4.0.0-beta.79

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 (70) hide show
  1. package/dist/BunClusterHttp.d.ts +5 -31
  2. package/dist/BunClusterHttp.d.ts.map +1 -1
  3. package/dist/BunClusterHttp.js.map +1 -1
  4. package/dist/BunClusterSocket.d.ts +6 -33
  5. package/dist/BunClusterSocket.d.ts.map +1 -1
  6. package/dist/BunClusterSocket.js +6 -33
  7. package/dist/BunClusterSocket.js.map +1 -1
  8. package/dist/BunFileSystem.d.ts.map +1 -1
  9. package/dist/BunFileSystem.js +3 -19
  10. package/dist/BunFileSystem.js.map +1 -1
  11. package/dist/BunHttpPlatform.d.ts.map +1 -1
  12. package/dist/BunHttpPlatform.js.map +1 -1
  13. package/dist/BunHttpServer.d.ts +7 -28
  14. package/dist/BunHttpServer.d.ts.map +1 -1
  15. package/dist/BunHttpServer.js.map +1 -1
  16. package/dist/BunHttpServerRequest.d.ts +4 -20
  17. package/dist/BunHttpServerRequest.d.ts.map +1 -1
  18. package/dist/BunHttpServerRequest.js.map +1 -1
  19. package/dist/BunMultipart.d.ts +3 -15
  20. package/dist/BunMultipart.d.ts.map +1 -1
  21. package/dist/BunMultipart.js.map +1 -1
  22. package/dist/BunPath.d.ts.map +1 -1
  23. package/dist/BunPath.js +0 -22
  24. package/dist/BunPath.js.map +1 -1
  25. package/dist/BunRedis.d.ts +4 -29
  26. package/dist/BunRedis.d.ts.map +1 -1
  27. package/dist/BunRedis.js +4 -29
  28. package/dist/BunRedis.js.map +1 -1
  29. package/dist/BunRuntime.d.ts.map +1 -1
  30. package/dist/BunRuntime.js +3 -26
  31. package/dist/BunRuntime.js.map +1 -1
  32. package/dist/BunServices.d.ts +5 -18
  33. package/dist/BunServices.d.ts.map +1 -1
  34. package/dist/BunServices.js.map +1 -1
  35. package/dist/BunSocket.d.ts +4 -16
  36. package/dist/BunSocket.d.ts.map +1 -1
  37. package/dist/BunSocket.js.map +1 -1
  38. package/dist/BunStdio.d.ts.map +1 -1
  39. package/dist/BunStdio.js +4 -27
  40. package/dist/BunStdio.js.map +1 -1
  41. package/dist/BunStream.d.ts.map +1 -1
  42. package/dist/BunStream.js +0 -22
  43. package/dist/BunStream.js.map +1 -1
  44. package/dist/BunTerminal.d.ts.map +1 -1
  45. package/dist/BunTerminal.js +3 -29
  46. package/dist/BunTerminal.js.map +1 -1
  47. package/dist/BunWorker.d.ts.map +1 -1
  48. package/dist/BunWorker.js +6 -32
  49. package/dist/BunWorker.js.map +1 -1
  50. package/dist/BunWorkerRunner.d.ts.map +1 -1
  51. package/dist/BunWorkerRunner.js +5 -29
  52. package/dist/BunWorkerRunner.js.map +1 -1
  53. package/package.json +4 -4
  54. package/src/BunClusterHttp.ts +5 -31
  55. package/src/BunClusterSocket.ts +6 -33
  56. package/src/BunFileSystem.ts +3 -19
  57. package/src/BunHttpPlatform.ts +5 -19
  58. package/src/BunHttpServer.ts +7 -28
  59. package/src/BunHttpServerRequest.ts +4 -20
  60. package/src/BunMultipart.ts +3 -15
  61. package/src/BunPath.ts +0 -22
  62. package/src/BunRedis.ts +4 -29
  63. package/src/BunRuntime.ts +3 -26
  64. package/src/BunServices.ts +5 -18
  65. package/src/BunSocket.ts +4 -16
  66. package/src/BunStdio.ts +4 -27
  67. package/src/BunStream.ts +0 -22
  68. package/src/BunTerminal.ts +3 -29
  69. package/src/BunWorker.ts +6 -32
  70. package/src/BunWorkerRunner.ts +5 -29
package/dist/BunRedis.js CHANGED
@@ -2,35 +2,10 @@
2
2
  * Bun Redis integration backed by Bun's built-in `RedisClient`.
3
3
  *
4
4
  * This module creates scoped Bun `RedisClient` connections and exposes them as
5
- * both the portable `Redis` service used by Effect persistence modules and the
6
- * Bun-specific `BunRedis` service for direct access to the raw client. Use it in
7
- * Bun applications that need Redis-backed persistence, persisted queues,
8
- * distributed rate limiting, custom Redis commands, or Bun Redis features such
9
- * as pub/sub.
10
- *
11
- * **Mental model**
12
- *
13
- * `layer` and `layerConfig` acquire one `RedisClient` for the layer scope. The
14
- * same client backs the portable `Redis.Redis` command interface and the
15
- * `BunRedis` service, and it is closed with `close` when the scope finalizes.
16
- * Install the layer at the lifetime you want for that connection.
17
- *
18
- * **Common tasks**
19
- *
20
- * Pass a Redis URL or Bun `RedisOptions` to `layer` for direct configuration,
21
- * or use `layerConfig` when connection settings should come from Effect
22
- * configuration. Depend on `Redis.Redis` for persistence and rate limiter
23
- * stores. Depend on `BunRedis` when you need `RedisClient` features that are
24
- * not exposed by the portable service, including custom commands and pub/sub.
25
- *
26
- * **Gotchas**
27
- *
28
- * Pub/sub should normally use a separately scoped client so a subscription does
29
- * not interfere with ordinary command traffic. Persistence and rate limiter
30
- * stores build keys and Lua scripts on top of this service, so choose stable
31
- * prefixes and store ids, account for persisted values that may fail to decode
32
- * after schema changes, and avoid unbounded high-cardinality rate-limit keys
33
- * without a cleanup or bounding strategy.
5
+ * both the portable `Redis` service and the Bun-specific `BunRedis` service for
6
+ * direct access to the raw client. The `layer` helper accepts Redis options
7
+ * directly, while `layerConfig` reads them from Effect config. Both close the
8
+ * underlying client when the layer scope finalizes.
34
9
  *
35
10
  * @since 4.0.0
36
11
  */
@@ -1 +1 @@
1
- {"version":3,"file":"BunRedis.js","names":["RedisClient","Config","Context","Effect","Fn","Layer","Scope","Redis","BunRedis","Service","make","fnUntraced","options","scope","addFinalizer","sync","client","close","url","use","f","tryPromise","try","catch","cause","RedisError","redis","send","command","args","bunRedis","identity","pipe","add","layer","effectContext","layerConfig","unwrap","flatMap"],"sources":["../src/BunRedis.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAASA,WAAW,QAA2B,KAAK;AACpD,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OA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,IAAI,CAACF,QAAQ,EAAEsB,QAAQ,CAAC,CAACE,IAAI,CAC1C9B,OAAO,CAAC+B,GAAG,CAAC1B,KAAK,CAACA,KAAK,EAAEmB,KAAK,CAAC,CAChC;AACH,CAAC,CAAC;AAEF;;;;;;AAMA,OAAO,MAAMQ,KAAK,GAChBtB,OAAgE,IACxBP,KAAK,CAAC8B,aAAa,CAACzB,IAAI,CAACE,OAAO,CAAC,CAAC;AAE5E;;;;;;AAMA,OAAO,MAAMwB,WAAW,GACtBxB,OAA8D,IAE9DP,KAAK,CAAC8B,aAAa,CACjBlC,MAAM,CAACoC,MAAM,CAACzB,OAAO,CAAC,CAACoB,IAAI,CACzB7B,MAAM,CAACmC,OAAO,CAAC5B,IAAI,CAAC,CACrB,CACF","ignoreList":[]}
1
+ {"version":3,"file":"BunRedis.js","names":["RedisClient","Config","Context","Effect","Fn","Layer","Scope","Redis","BunRedis","Service","make","fnUntraced","options","scope","addFinalizer","sync","client","close","url","use","f","tryPromise","try","catch","cause","RedisError","redis","send","command","args","bunRedis","identity","pipe","add","layer","effectContext","layerConfig","unwrap","flatMap"],"sources":["../src/BunRedis.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;AAWA,SAASA,WAAW,QAA2B,KAAK;AACpD,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,EAAE,MAAM,iBAAiB;AACrC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,KAAK,MAAM,mCAAmC;AAE1D;;;;;;AAMA,OAAM,MAAOC,QAAS,sBAAQN,OAAO,CAACO,OAAO,EAGzC,CAAC,+BAA+B,CAAC;AAErC,MAAMC,IAAI,gBAAGP,MAAM,CAACQ,UAAU,CAAC,WAC7BC,OAEgB;EAEhB,MAAMC,KAAK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8D,IAE9DP,KAAK,CAAC8B,aAAa,CACjBlC,MAAM,CAACoC,MAAM,CAACzB,OAAO,CAAC,CAACoB,IAAI,CACzB7B,MAAM,CAACmC,OAAO,CAAC5B,IAAI,CAAC,CACrB,CACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"BunRuntime.d.ts","sourceRoot":"","sources":["../src/BunRuntime.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,OAAO,EAAE;IACpB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,CACE,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;QACpD,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;KACzC,GACA,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAA;IACvC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,CAAC,CAAC,EAAE,CAAC,EACH,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;QACpD,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;KACzC,GACA,IAAI,CAAA;CACc,CAAA"}
1
+ {"version":3,"file":"BunRuntime.d.ts","sourceRoot":"","sources":["../src/BunRuntime.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,OAAO,EAAE;IACpB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,CACE,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;QACpD,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;KACzC,GACA,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAA;IACvC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,CAAC,CAAC,EAAE,CAAC,EACH,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;QACpD,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;KACzC,GACA,IAAI,CAAA;CACc,CAAA"}
@@ -1,32 +1,9 @@
1
1
  /**
2
2
  * Bun process runner for Effect programs.
3
3
  *
4
- * This module exposes Bun's `runMain` entry point. It is the function to call
5
- * at the outer edge of a Bun CLI, script, server, or worker when a single
6
- * Effect should become the process main fiber and use Bun's Node-compatible
7
- * process, signal, and teardown behavior.
8
- *
9
- * **Mental model**
10
- *
11
- * `runMain` delegates to the shared Node-compatible runner. It starts the
12
- * supplied Effect as the process root, reports failures through the configured
13
- * runtime reporting, and translates `SIGINT` or `SIGTERM` into interruption so
14
- * scoped resources can finalize before teardown chooses an exit code.
15
- *
16
- * **Common tasks**
17
- *
18
- * - Launch a Bun CLI or one-off script from an Effect.
19
- * - Start a long-running Bun server or worker under an Effect scope.
20
- * - Customize error reporting or teardown with `runMain` options.
21
- * - Provide `BunServices.layer` or narrower layers before calling `runMain`.
22
- *
23
- * **Gotchas**
24
- *
25
- * This module runs the program; it does not provide filesystem, network,
26
- * terminal, or other platform services. Long-lived servers, subscriptions, and
27
- * worker loops should be acquired in Effect scopes so interruption from process
28
- * signals can release them. Finalizers that never complete can keep shutdown
29
- * waiting.
4
+ * This module exports `runMain`, which runs one Effect as the main process
5
+ * fiber in Bun. It reuses the shared Node runtime runner, including its error
6
+ * reporting, signal handling, and optional teardown behavior.
30
7
  *
31
8
  * @since 4.0.0
32
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"BunRuntime.js","names":["NodeRuntime","runMain"],"sources":["../src/BunRuntime.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,OAAO,KAAKA,WAAW,MAAM,0CAA0C;AAIvE;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,OAAO,MAAMC,OAAO,GA8DhBD,WAAW,CAACC,OAAO","ignoreList":[]}
1
+ {"version":3,"file":"BunRuntime.js","names":["NodeRuntime","runMain"],"sources":["../src/BunRuntime.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;AASA,OAAO,KAAKA,WAAW,MAAM,0CAA0C;AAIvE;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,OAAO,MAAMC,OAAO,GA8DhBD,WAAW,CAACC,OAAO","ignoreList":[]}
@@ -1,23 +1,10 @@
1
1
  /**
2
- * Provides the aggregate Bun platform services layer for applications that run
3
- * on the Bun runtime.
2
+ * Aggregate Bun platform services layer.
4
3
  *
5
- * This module is useful when an application needs the standard Bun-backed
6
- * implementations of filesystem access, path operations, stdio, terminal
7
- * interaction, and child process spawning from a single layer. Provide
8
- * `BunServices.layer` near the edge of a program to satisfy effects that read
9
- * or write files, resolve paths, interact with stdin/stdout/stderr or a
10
- * terminal, or launch subprocesses.
11
- *
12
- * The layer only supplies the runtime services listed by `BunServices`; it does
13
- * not provide unrelated platform services such as HTTP clients, HTTP servers,
14
- * sockets, workers, or Redis. Several of these core Bun services are backed by
15
- * the shared Node-compatible implementations used by the Bun adapters, so the
16
- * default path, stdio, terminal, and subprocess behavior follows the current
17
- * process and host platform. Libraries should continue to depend on the
18
- * individual service tags they use, while Bun applications, CLIs, and tests can
19
- * choose this layer or narrower service-specific layers depending on how much
20
- * of the Bun runtime they want to expose.
4
+ * This module defines the `BunServices` union and a single `layer` that
5
+ * provides Bun-backed child process spawning, crypto, filesystem, path, stdio,
6
+ * and terminal services. Use the layer when a Bun program wants the standard
7
+ * platform services from one place.
21
8
  *
22
9
  * @since 4.0.0
23
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"BunServices.d.ts","sourceRoot":"","sources":["../src/BunServices.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAA;AAQtF;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG,MAAM,GAAG,UAAU,GAAG,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAA;AAE7F;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAQ1C,CAAA"}
1
+ {"version":3,"file":"BunServices.d.ts","sourceRoot":"","sources":["../src/BunServices.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAA;AAQtF;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG,MAAM,GAAG,UAAU,GAAG,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAA;AAE7F;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAQ1C,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"BunServices.js","names":["Layer","BunChildProcessSpawner","BunCrypto","BunFileSystem","BunPath","BunStdio","BunTerminal","layer","pipe","provideMerge","mergeAll"],"sources":["../src/BunServices.ts"],"sourcesContent":[null],"mappings":"AAyBA,OAAO,KAAKA,KAAK,MAAM,cAAc;AAKrC,OAAO,KAAKC,sBAAsB,MAAM,6BAA6B;AACrE,OAAO,KAAKC,SAAS,MAAM,gBAAgB;AAC3C,OAAO,KAAKC,aAAa,MAAM,oBAAoB;AACnD,OAAO,KAAKC,OAAO,MAAM,cAAc;AACvC,OAAO,KAAKC,QAAQ,MAAM,eAAe;AACzC,OAAO,KAAKC,WAAW,MAAM,kBAAkB;AAW/C;;;;;;;AAOA,OAAO,MAAMC,KAAK,gBAA6BN,sBAAsB,CAACM,KAAK,CAACC,IAAI,cAC9ER,KAAK,CAACS,YAAY,cAACT,KAAK,CAACU,QAAQ,CAC/BP,aAAa,CAACI,KAAK,EACnBL,SAAS,CAACK,KAAK,EACfH,OAAO,CAACG,KAAK,EACbF,QAAQ,CAACE,KAAK,EACdD,WAAW,CAACC,KAAK,CAClB,CAAC,CACH","ignoreList":[]}
1
+ {"version":3,"file":"BunServices.js","names":["Layer","BunChildProcessSpawner","BunCrypto","BunFileSystem","BunPath","BunStdio","BunTerminal","layer","pipe","provideMerge","mergeAll"],"sources":["../src/BunServices.ts"],"sourcesContent":[null],"mappings":"AAYA,OAAO,KAAKA,KAAK,MAAM,cAAc;AAKrC,OAAO,KAAKC,sBAAsB,MAAM,6BAA6B;AACrE,OAAO,KAAKC,SAAS,MAAM,gBAAgB;AAC3C,OAAO,KAAKC,aAAa,MAAM,oBAAoB;AACnD,OAAO,KAAKC,OAAO,MAAM,cAAc;AACvC,OAAO,KAAKC,QAAQ,MAAM,eAAe;AACzC,OAAO,KAAKC,WAAW,MAAM,kBAAkB;AAW/C;;;;;;;AAOA,OAAO,MAAMC,KAAK,gBAA6BN,sBAAsB,CAACM,KAAK,CAACC,IAAI,cAC9ER,KAAK,CAACS,YAAY,cAACT,KAAK,CAACU,QAAQ,CAC/BP,aAAa,CAACI,KAAK,EACnBL,SAAS,CAACK,KAAK,EACfH,OAAO,CAACG,KAAK,EACbF,QAAQ,CAACE,KAAK,EACdD,WAAW,CAACC,KAAK,CAClB,CAAC,CACH","ignoreList":[]}
@@ -1,22 +1,10 @@
1
1
  /**
2
- * Bun platform socket entry point for Effect sockets backed by Bun-compatible
3
- * Node streams and Bun's native WebSocket implementation.
2
+ * Bun platform socket entry point for Effect sockets.
4
3
  *
5
4
  * This module re-exports the shared Node socket constructors for TCP clients,
6
- * Unix domain socket clients, and adapters from existing Node `Duplex` streams,
7
- * then adds Bun-specific WebSocket layers using `globalThis.WebSocket`. Use it
8
- * in Bun applications that connect to raw socket protocols, Unix sockets,
9
- * realtime WebSocket services, or Effect RPC transports that need a
10
- * `Socket.Socket` layer.
11
- *
12
- * TCP lifecycle behavior comes from the shared Node layer: sockets are scoped,
13
- * finalizers close or destroy the underlying stream, open timeouts become
14
- * socket open errors, and read, write, and close events are mapped to
15
- * `SocketError` values. TLS concerns depend on the transport being used: `wss:`
16
- * URLs are handled by Bun's WebSocket implementation, while TLS-wrapped
17
- * `Duplex` streams can be adapted after they have been created elsewhere.
18
- * When closing intentionally, send `Socket.CloseEvent` values so the close code
19
- * and reason are preserved through the socket lifecycle.
5
+ * Unix domain socket clients, and adapters from existing Node `Duplex` streams.
6
+ * It also provides Bun WebSocket layers using `globalThis.WebSocket`, including
7
+ * a constructor layer and a `Socket.Socket` layer for a WebSocket URL.
20
8
  *
21
9
  * @since 4.0.0
22
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"BunSocket.d.ts","sourceRoot":"","sources":["../src/BunSocket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAA;AAEvD;;GAEG;AACH,cAAc,yCAAyC,CAAA;AAEvD;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,KAAK,CACjD,MAAM,CAAC,oBAAoB,CAG5B,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,EAAE,CAC3B,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAC5B,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,SAAS,CAAA;IACnE,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAA;IACjD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,CAAA;CACxD,GAAG,SAAS,KACV,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAI3C,CAAA"}
1
+ {"version":3,"file":"BunSocket.d.ts","sourceRoot":"","sources":["../src/BunSocket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAA;AAEvD;;GAEG;AACH,cAAc,yCAAyC,CAAA;AAEvD;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,KAAK,CACjD,MAAM,CAAC,oBAAoB,CAG5B,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,EAAE,CAC3B,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAC5B,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,SAAS,CAAA;IACnE,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAA;IACjD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,CAAA;CACxD,GAAG,SAAS,KACV,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAI3C,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"BunSocket.js","names":["flow","Layer","Socket","layerWebSocketConstructor","succeed","WebSocketConstructor","url","protocols","globalThis","WebSocket","layerWebSocket","makeWebSocket","effect","provide"],"sources":["../src/BunSocket.ts"],"sourcesContent":[null],"mappings":"AAwBA,SAASA,IAAI,QAAQ,iBAAiB;AACtC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,MAAM,MAAM,+BAA+B;AAEvD;;;AAGA,cAAc,yCAAyC;AAEvD;;;;;;;AAOA,OAAO,MAAMC,yBAAyB,gBAElCF,KAAK,CAACG,OAAO,CAACF,MAAM,CAACG,oBAAoB,CAAC,CAC5C,CAACC,GAAG,EAAEC,SAAS,KAAK,IAAIC,UAAU,CAACC,SAAS,CAACH,GAAG,EAAEC,SAAS,CAAC,CAC7D;AAED;;;;;;;;AAQA,OAAO,MAAMG,cAAc,gBAOqBV,IAAI,CAClDE,MAAM,CAACS,aAAa,eACpBV,KAAK,CAACW,MAAM,CAACV,MAAM,CAACA,MAAM,CAAC,eAC3BD,KAAK,CAACY,OAAO,CAACV,yBAAyB,CAAC,CACzC","ignoreList":[]}
1
+ {"version":3,"file":"BunSocket.js","names":["flow","Layer","Socket","layerWebSocketConstructor","succeed","WebSocketConstructor","url","protocols","globalThis","WebSocket","layerWebSocket","makeWebSocket","effect","provide"],"sources":["../src/BunSocket.ts"],"sourcesContent":[null],"mappings":"AAYA,SAASA,IAAI,QAAQ,iBAAiB;AACtC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,MAAM,MAAM,+BAA+B;AAEvD;;;AAGA,cAAc,yCAAyC;AAEvD;;;;;;;AAOA,OAAO,MAAMC,yBAAyB,gBAElCF,KAAK,CAACG,OAAO,CAACF,MAAM,CAACG,oBAAoB,CAAC,CAC5C,CAACC,GAAG,EAAEC,SAAS,KAAK,IAAIC,UAAU,CAACC,SAAS,CAACH,GAAG,EAAEC,SAAS,CAAC,CAC7D;AAED;;;;;;;;AAQA,OAAO,MAAMG,cAAc,gBAOqBV,IAAI,CAClDE,MAAM,CAACS,aAAa,eACpBV,KAAK,CAACW,MAAM,CAACV,MAAM,CAACA,MAAM,CAAC,eAC3BD,KAAK,CAACY,OAAO,CAACV,yBAAyB,CAAC,CACzC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"BunStdio.d.ts","sourceRoot":"","sources":["../src/BunStdio.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAmB,CAAA"}
1
+ {"version":3,"file":"BunStdio.d.ts","sourceRoot":"","sources":["../src/BunStdio.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAmB,CAAA"}
package/dist/BunStdio.js CHANGED
@@ -1,33 +1,10 @@
1
1
  /**
2
2
  * Process stdio for Bun applications.
3
3
  *
4
- * This module provides the Bun layer for Effect's `Stdio` service by adapting
5
- * the current process arguments and standard streams. Arguments come from
6
- * `process.argv`, input is read from `process.stdin`, and output and error
7
- * output write to `process.stdout` and `process.stderr`.
8
- *
9
- * **Mental model**
10
- *
11
- * `BunStdio.layer` is a thin Bun-facing wrapper around the shared
12
- * Node-compatible stdio implementation. It does not create private streams for
13
- * an application; it exposes the global streams owned by the running Bun
14
- * process through the `Stdio` service.
15
- *
16
- * **Common tasks**
17
- *
18
- * - Provide `Stdio` for Bun CLIs, scripts, command runners, and tests.
19
- * - Read process arguments or standard input through Effect services.
20
- * - Write normal output and diagnostics without depending directly on
21
- * `process.stdout` or `process.stderr`.
22
- *
23
- * **Gotchas**
24
- *
25
- * The layer keeps stdin open and does not end stdout or stderr by default,
26
- * which avoids closing handles that prompts, loggers, or other code may still
27
- * use. Stdio may be attached to a TTY, pipe, or redirected file, so
28
- * terminal-specific behavior such as raw mode, echo, colors, cursor control,
29
- * and terminal dimensions should be handled with terminal APIs such as
30
- * `BunTerminal`, not inferred from this layer.
4
+ * This module provides the Bun layer for Effect's `Stdio` service by using the
5
+ * shared Node stdio implementation. Arguments come from `process.argv`, input
6
+ * is read from `process.stdin`, and output and error output write to
7
+ * `process.stdout` and `process.stderr`.
31
8
  *
32
9
  * @since 4.0.0
33
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"BunStdio.js","names":["NodeStdio","layer"],"sources":["../src/BunStdio.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,OAAO,KAAKA,SAAS,MAAM,wCAAwC;AAInE;;;;;;;AAOA,OAAO,MAAMC,KAAK,GAAuBD,SAAS,CAACC,KAAK","ignoreList":[]}
1
+ {"version":3,"file":"BunStdio.js","names":["NodeStdio","layer"],"sources":["../src/BunStdio.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;AAUA,OAAO,KAAKA,SAAS,MAAM,wCAAwC;AAInE;;;;;;;AAOA,OAAO,MAAMC,KAAK,GAAuBD,SAAS,CAACC,KAAK","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"BunStream.d.ts","sourceRoot":"","sources":["../src/BunStream.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAG9C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC;;GAEG;AACH,cAAc,yCAAyC,CAAA;AAEvD;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAAE,CAAC,EACrC,SAAS;IACP,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;IAC7C,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC,CAAA;IACvC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAChD,KACA,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CA6Bf,CAAA"}
1
+ {"version":3,"file":"BunStream.d.ts","sourceRoot":"","sources":["../src/BunStream.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAG9C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC;;GAEG;AACH,cAAc,yCAAyC,CAAA;AAEvD;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAAE,CAAC,EACrC,SAAS;IACP,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;IAC7C,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC,CAAA;IACvC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAChD,KACA,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CA6Bf,CAAA"}
package/dist/BunStream.js CHANGED
@@ -7,28 +7,6 @@
7
7
  * `ReadableStream` adapter that uses Bun's `readMany` reader method to pull
8
8
  * batches of values into an Effect `Stream`.
9
9
  *
10
- * **Mental model**
11
- *
12
- * Consuming the returned `Stream` drives reads from the underlying
13
- * `ReadableStreamDefaultReader`. Each pull asks Bun for the next batch, empty
14
- * batches are skipped, read failures are translated with `onError`, and the
15
- * reader is finalized with the surrounding Effect scope.
16
- *
17
- * **Common tasks**
18
- *
19
- * Use {@link fromReadableStream} for Bun `Request` and `Response` bodies,
20
- * multipart uploads, and other Web stream sources that should be transformed,
21
- * decoded, or piped with Effect stream operators. Use the re-exported Node
22
- * stream adapters for APIs that expose Bun's Node-compatible `stream` types.
23
- *
24
- * **Gotchas**
25
- *
26
- * Web stream readers hold an exclusive lock. Request and response bodies are
27
- * also one-shot; once consumed they are disturbed and should not be read through
28
- * another API. By default finalization cancels the reader; set
29
- * `releaseLockOnEnd` when the stream is externally owned and only the reader
30
- * lock should be released.
31
- *
32
10
  * @since 4.0.0
33
11
  */
34
12
  import * as Arr from "effect/Array";
@@ -1 +1 @@
1
- {"version":3,"file":"BunStream.js","names":["Arr","Cause","Channel","Effect","Scope","Stream","fromReadableStream","options","fromChannel","fromTransform","fnUntraced","_","scope","reader","evaluate","getReader","addFinalizer","releaseLockOnEnd","sync","releaseLock","promise","cancel","readMany","callback","resume","result","then","succeed","e","fail","onError","flatMap","loop","done","value","isReadonlyArrayNonEmpty"],"sources":["../src/BunStream.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,OAAO,KAAKA,GAAG,MAAM,cAAc;AACnC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AAGvC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,MAAM,MAAM,eAAe;AAEvC;;;AAGA,cAAc,yCAAyC;AAEvD;;;;;;;AAOA,OAAO,MAAMC,kBAAkB,GAC7BC,OAIC,IAEDF,MAAM,CAACG,WAAW,CAACN,OAAO,CAACO,aAAa,CAACN,MAAM,CAACO,UAAU,CAAC,WAAUC,CAAC,EAAEC,KAAK;EAC3E,MAAMC,MAAM,GAAGN,OAAO,CAACO,QAAQ,EAAE,CAACC,SAAS,EAAE;EAC7C,OAAOX,KAAK,CAACY,YAAY,CACvBJ,KAAK,EACLL,OAAO,CAACU,gBAAgB,GAAGd,MAAM,CAACe,IAAI,CAAC,MAAML,MAAM,CAACM,WAAW,EAAE,CAAC,GAAGhB,MAAM,CAACiB,OAAO,CAAC,MAAMP,MAAM,CAACQ,MAAM,EAAE,CAAC,CAC3G;EACD,MAAMC,QAAQ,GAAGnB,MAAM,CAACoB,QAAQ,CAAiDC,MAAM,IAAI;IACzF,MAAMC,MAAM,GAAGZ,MAAM,CAACS,QAAQ,EAAE;IAChC,IAAI,MAAM,IAAIG,MAAM,EAAE;MACpBA,MAAM,CAACC,IAAI,CAAEf,CAAC,IAAKa,MAAM,CAACrB,MAAM,CAACwB,OAAO,CAAChB,CAAC,CAAC,CAAC,EAAGiB,CAAC,IAAKJ,MAAM,CAACrB,MAAM,CAAC0B,IAAI,CAACtB,OAAO,CAACuB,OAAO,CAACF,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/F,CAAC,MAAM;MACLJ,MAAM,CAACrB,MAAM,CAACwB,OAAO,CAACF,MAAM,CAAC,CAAC;IAChC;EACF,CAAC,CAAC;EACF;EACA,OAAOtB,MAAM,CAAC4B,OAAO,CACnBT,QAAQ,EACR,SAASU,IAAIA,CACX;IAAEC,IAAI;IAAEC;EAAK,CAAE;IAEf,IAAID,IAAI,EAAE;MACR,OAAOhC,KAAK,CAACgC,IAAI,EAAE;IACrB,CAAC,MAAM,IAAI,CAACjC,GAAG,CAACmC,uBAAuB,CAACD,KAAK,CAAC,EAAE;MAC9C,OAAO/B,MAAM,CAAC4B,OAAO,CAACT,QAAQ,EAAEU,IAAI,CAAC;IACvC;IACA,OAAO7B,MAAM,CAACwB,OAAO,CAACO,KAAK,CAAC;EAC9B,CAAC,CACF;AACH,CAAC,CAAC,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"BunStream.js","names":["Arr","Cause","Channel","Effect","Scope","Stream","fromReadableStream","options","fromChannel","fromTransform","fnUntraced","_","scope","reader","evaluate","getReader","addFinalizer","releaseLockOnEnd","sync","releaseLock","promise","cancel","readMany","callback","resume","result","then","succeed","e","fail","onError","flatMap","loop","done","value","isReadonlyArrayNonEmpty"],"sources":["../src/BunStream.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;AAWA,OAAO,KAAKA,GAAG,MAAM,cAAc;AACnC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AAGvC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,MAAM,MAAM,eA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AO/B,MAAM,CAAC4B,OAAO,CAACT,QAAQ,EAAEU,IAAI,CAAC;IACvC;IACA,OAAO7B,MAAM,CAACwB,OAAO,CAACO,KAAK,CAAC;EAC9B,CAAC,CACF;AACH,CAAC,CAAC,CAAC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"BunTerminal.d.ts","sourceRoot":"","sources":["../src/BunTerminal.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE1D;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAqB,CAAA;AAErH;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAsB,CAAA"}
1
+ {"version":3,"file":"BunTerminal.d.ts","sourceRoot":"","sources":["../src/BunTerminal.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE1D;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAqB,CAAA;AAErH;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAsB,CAAA"}
@@ -1,35 +1,9 @@
1
1
  /**
2
2
  * Bun-backed implementation of Effect's `Terminal` service.
3
3
  *
4
- * This module adapts Bun's Node-compatible `stdin`, `stdout`, and `readline`
5
- * support into a scoped `Terminal` service. It is intended for Bun CLIs,
6
- * prompts, REPLs, and terminal interfaces that need prompt output, line input,
7
- * keypress input, or terminal dimensions through Effect services.
8
- *
9
- * **Mental model**
10
- *
11
- * - {@link make} creates a scoped terminal from the current process streams.
12
- * - {@link layer} provides the default live terminal service for Bun programs.
13
- * - The implementation reuses the shared Node-compatible terminal adapter, so
14
- * behavior follows the capabilities of Bun's process streams and readline
15
- * support.
16
- *
17
- * **Common tasks**
18
- *
19
- * - Provide terminal access at the edge of a Bun CLI with {@link layer}.
20
- * - Customize which key ends keypress input by calling {@link make} directly.
21
- * - Read lines, read keypresses, display prompts, and inspect terminal size
22
- * through the `Terminal` service once it is provided.
23
- *
24
- * **Gotchas**
25
- *
26
- * - The service uses global process streams. Acquire it with a scope, or
27
- * provide {@link layer}, so raw mode and readline listeners are cleaned up.
28
- * - When `stdin` is a TTY, raw mode is enabled while the terminal is active and
29
- * restored when the scope closes; this changes how keys are delivered and can
30
- * affect other stdin consumers.
31
- * - In pipes, redirected input, or CI, raw mode may be unavailable, keypress
32
- * input is limited, and stdout dimensions may be reported as zero.
4
+ * This module reuses the shared Node terminal implementation for Bun. `make`
5
+ * creates a scoped process-backed `Terminal` service, and `layer` provides the
6
+ * default terminal service with the standard quit behavior for key input.
33
7
  *
34
8
  * @since 4.0.0
35
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"BunTerminal.js","names":["NodeTerminal","make","layer"],"sources":["../src/BunTerminal.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,OAAO,KAAKA,YAAY,MAAM,2CAA2C;AAMzE;;;;;;;AAOA,OAAO,MAAMC,IAAI,GAAmFD,YAAY,CAACC,IAAI;AAErH;;;;;;;AAOA,OAAO,MAAMC,KAAK,GAAoBF,YAAY,CAACE,KAAK","ignoreList":[]}
1
+ {"version":3,"file":"BunTerminal.js","names":["NodeTerminal","make","layer"],"sources":["../src/BunTerminal.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;AASA,OAAO,KAAKA,YAAY,MAAM,2CAA2C;AAMzE;;;;;;;AAOA,OAAO,MAAMC,IAAI,GAAmFD,YAAY,CAACC,IAAI;AAErH;;;;;;;AAOA,OAAO,MAAMC,KAAK,GAAoBF,YAAY,CAACE,KAAK","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"BunWorker.d.ts","sourceRoot":"","sources":["../src/BunWorker.ts"],"names":[],"mappings":"AAyCA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,MAAM,MAAM,gCAAgC,CAAA;AAGxD;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAChB,OAAO,CAAC,EAAE,EAAE,MAAM,KAAK,UAAU,CAAC,MAAM,KACvC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,OAAO,CAIlD,CAAA;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,kDAgDzB,CAAA"}
1
+ {"version":3,"file":"BunWorker.d.ts","sourceRoot":"","sources":["../src/BunWorker.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,MAAM,MAAM,gCAAgC,CAAA;AAGxD;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAChB,OAAO,CAAC,EAAE,EAAE,MAAM,KAAK,UAAU,CAAC,MAAM,KACvC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,OAAO,CAIlD,CAAA;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,kDAgDzB,CAAA"}
package/dist/BunWorker.js CHANGED
@@ -1,38 +1,12 @@
1
1
  /**
2
2
  * Parent-side worker support for Bun applications.
3
3
  *
4
- * This module provides the `WorkerPlatform` used by Bun programs that spawn and
5
- * communicate with `globalThis.Worker` instances through Effect's worker
6
- * protocol. Pair it with `BunWorkerRunner` in the worker entrypoint when
7
- * building worker-backed RPC clients, moving CPU-bound work off the main
8
- * thread, isolating Bun-only services, or hosting long-lived handlers behind a
9
- * typed message boundary.
10
- *
11
- * **Mental model**
12
- *
13
- * `layer(spawn)` installs both the Bun `WorkerPlatform` and a `Worker.Spawner`.
14
- * The supplied `spawn` function creates the Bun worker for each numeric worker
15
- * id. The platform listens for worker messages and errors, wraps outgoing data
16
- * in the Effect worker protocol, and buffers `send` calls until the worker
17
- * runner posts its ready signal.
18
- *
19
- * **Common tasks**
20
- *
21
- * - Run Effect worker clients in a Bun parent process.
22
- * - Move RPC handlers, CPU-bound computations, or Bun-only services into a
23
- * dedicated worker.
24
- * - Provide custom worker creation logic while keeping message handling and
25
- * cleanup inside Effect scopes.
26
- *
27
- * **Gotchas**
28
- *
29
- * This module is for the parent side only; the worker entrypoint must start
30
- * `BunWorkerRunner`. If the runner never starts or never posts readiness,
31
- * buffered messages will not be delivered. Payloads and transfer lists use
32
- * Bun's worker cloning and transfer semantics, so they must be accepted by the
33
- * Bun worker runtime. Scope finalization sends the Effect worker close signal,
34
- * waits for Bun's `close` event for a short grace period, and then terminates
35
- * the worker if graceful shutdown does not complete.
4
+ * `layerPlatform` provides the `WorkerPlatform` used to communicate with
5
+ * `globalThis.Worker` instances through Effect's worker protocol. `layer`
6
+ * combines that platform with a `Spawner` built from a callback that creates a
7
+ * worker for each worker id. The platform forwards worker messages and errors,
8
+ * asks workers to close on scope finalization, and terminates them if graceful
9
+ * shutdown times out.
36
10
  *
37
11
  * @since 4.0.0
38
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"BunWorker.js","names":["Deferred","Effect","Exit","Layer","Scope","Worker","WorkerError","WorkerUnknownError","layer","spawn","merge","layerPlatform","succeed","Spawner","WorkerPlatform","makePlatform","setup","scope","worker","closeDeferred","makeUnsafe","addEventListener","doneUnsafe","void","as","addFinalizer","suspend","postMessage","await","pipe","interruptible","timeout","catchCause","sync","terminate","listen","deferred","emit","port","onMessage","event","data","onError","reason","message","cause","error","removeEventListener"],"sources":["../src/BunWorker.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,OAAO,KAAKA,QAAQ,MAAM,iBAAiB;AAC3C,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,IAAI,MAAM,aAAa;AACnC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,MAAM,MAAM,gCAAgC;AACxD,SAASC,WAAW,EAAEC,kBAAkB,QAAQ,qCAAqC;AAErF;;;;;;;AAOA,OAAO,MAAMC,KAAK,GAChBC,KAAwC,IAExCN,KAAK,CAACO,KAAK,CACTC,aAAa,EACbR,KAAK,CAACS,OAAO,CAACP,MAAM,CAACQ,OAAO,CAAC,CAACJ,KAAK,CAAC,CACrC;AAEH;;;;;;;;AAQA,OAAO,MAAME,aAAa,gBAAGR,KAAK,CAACS,OAAO,CAACP,MAAM,CAACS,cAAc,CAAC,cAC/DT,MAAM,CAACU,YAAY,EAAqB,CAAC;EACvCC,KAAKA,CAAC;IAAEC,KAAK;IAAEC;EAAM,CAAE;IACrB,MAAMC,aAAa,GAAGnB,QAAQ,CAACoB,UAAU,EAAQ;IACjDF,MAAM,CAACG,gBAAgB,CAAC,OAAO,EAAE,MAAK;MACpCrB,QAAQ,CAACsB,UAAU,CAACH,aAAa,EAAEjB,IAAI,CAACqB,IAAI,CAAC;IAC/C,CAAC,CAAC;IACF,OAAOtB,MAAM,CAACuB,EAAE,CACdpB,KAAK,CAACqB,YAAY,CAChBR,K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Worker.js","names":["Deferred","Effect","Exit","Layer","Scope","Worker","WorkerError","WorkerUnknownError","layer","spawn","merge","layerPlatform","succeed","Spawner","WorkerPlatform","makePlatform","setup","scope","worker","closeDeferred","makeUnsafe","addEventListener","doneUnsafe","void","as","addFinalizer","suspend","postMessage","await","pipe","interruptible","timeout","catchCause","sync","terminate","listen","deferred","emit","port","onMessage","event","data","onError","reason","message","cause","error","removeEventListener"],"sources":["../src/BunWorker.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;AAYA,OAAO,KAAKA,QAAQ,MAAM,iBAAiB;AAC3C,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,IAAI,MAAM,aAAa;AACnC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,MAAM,MAAM,gCAAgC;AACxD,SAASC,WAAW,EAAEC,kBAAkB,QAAQ,qCAAqC;AAErF;;;;;;;AAOA,OAAO,MAAMC,KAAK,GAChBC,KAAwC,IAExCN,KAAK,CAACO,KAAK,CACTC,aAAa,EACbR,KAAK,CAACS,OAAO,CAACP,MAAM,CAACQ,OAAO,CAAC,CAACJ,KAAK,CAAC,CACrC;AAEH;;;;;;;;AAQA,OAAO,MAAME,aAAa,gBAAGR,KAAK,CAACS,OAAO,CAACP,MAAM,CAACS,cAAc,CAAC,cAC/DT,MAAM,CAACU,YAAY,EAAqB,CAAC;EACvCC,KAAKA,CAAC;IAAEC,KAAK;IAAEC;EAAM,CAAE;IACrB,MAAMC,aAAa,GAAGnB,QAAQ,CAACoB,UAAU,EAAQ;IACjDF,MAAM,CAACG,gBAAgB,CAAC,OAAO,EAAE,MAAK;MACpCrB,QAAQ,CAACsB,UAAU,CAACH,aAAa,EAAEjB,IAAI,CAACqB,IAAI,CAAC;IAC/C,CAAC,CAAC;IACF,OAAOtB,MAAM,CAACuB,EAAE,CACdpB,KAAK,CAACqB,YAAY,CAChBR,KA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version":3,"file":"BunWorkerRunner.d.ts","sourceRoot":"","sources":["../src/BunWorkerRunner.ts"],"names":[],"mappings":"AAyCA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAGrC,OAAO,KAAK,YAAY,MAAM,sCAAsC,CAAA;AAIpE;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,oBAAoB,CAgF/D,CAAA"}
1
+ {"version":3,"file":"BunWorkerRunner.d.ts","sourceRoot":"","sources":["../src/BunWorkerRunner.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAGrC,OAAO,KAAK,YAAY,MAAM,sCAAsC,CAAA;AAIpE;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,oBAAoB,CAgF/D,CAAA"}
@@ -1,35 +1,11 @@
1
1
  /**
2
2
  * Worker-entrypoint support for Bun worker runners.
3
3
  *
4
- * This module provides the Bun `WorkerRunnerPlatform` for code already running
5
- * inside a Bun `Worker`. It receives request messages from the parent-side
6
- * `BunWorker` platform, runs the handler registered with `WorkerRunner.run`,
7
- * and posts responses back through Bun's worker `postMessage` channel.
8
- *
9
- * **Mental model**
10
- *
11
- * The parent process installs `BunWorker.layer`; the worker entrypoint installs
12
- * this `layer` and starts `WorkerRunner`. Bun exposes one worker port to this
13
- * runner, so every message uses port id `0`. The first message sent by this
14
- * layer is the ready signal consumed by the parent platform before buffered
15
- * sends are flushed.
16
- *
17
- * **Common tasks**
18
- *
19
- * - Host Effect worker or RPC handlers inside a Bun worker entrypoint.
20
- * - Move CPU-bound work or Bun-only services behind Effect's worker protocol.
21
- * - Send structured-clone payloads and transferables back to the parent with
22
- * `WorkerRunner.send`.
23
- *
24
- * **Gotchas**
25
- *
26
- * Start this layer only in the worker entrypoint; it fails when
27
- * `self.postMessage` is unavailable. Parent shutdown arrives as the worker
28
- * close message and closes the port, so long-running handlers should stay
29
- * interruptible and keep cleanup in scopes. Payloads, transfer lists, and
30
- * `messageerror` events follow Bun's worker runtime behavior.
31
- *
32
- * @see {@link layer} for the Bun worker-runner platform layer.
4
+ * This module exports a `layer` that provides `WorkerRunnerPlatform` for code
5
+ * already running inside a Bun `Worker`. The platform receives request messages
6
+ * from the parent-side `BunWorker` platform, runs the registered handler, sends
7
+ * responses through the worker `postMessage` channel, and closes when the
8
+ * parent sends the close message.
33
9
  *
34
10
  * @since 4.0.0
35
11
  */
@@ -1 +1 @@
1
- {"version":3,"file":"BunWorkerRunner.js","names":["Cause","Deferred","Effect","Exit","Fiber","identity","Layer","Scope","WorkerError","WorkerReceiveError","WorkerSpawnError","WorkerRunner","layer","succeed","WorkerRunnerPlatform","start","fnUntraced","self","reason","message","port","run","handler","scopedWith","scope","closeLatch","makeUnsafe","trackFiber","runIn","services","context","runFork","runForkWith","onExit","exit","_tag","hasInterruptsOnly","cause","logError","onMessage","event","data","result","isEffect","fiber","addObserver","close","doneUnsafe","void","onMessageError","error","onError","addFinalizer","sync","removeEventListener","addEventListener","postMessage","await","sendUnsafe","_portId","transfer","send"],"sources":["../src/BunWorkerRunner.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,OAAO,KAAKA,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,QAAQ,MAAM,iBAAiB;AAC3C,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,IAAI,MAAM,aAAa;AACnC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,SAASC,WAAW,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAQ,qCAAqC;AACvG,OAAO,KAAKC,YAAY,MAAM,sCAAsC;AAIpE;;;;;;;;AAQA,OA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,CAAC,CAAC,CAAC;IAEL,MAAMiC,UAAU,GAAGA,CAACC,OAAe,EAAExC,OAAU,EAAEyC,QAAiC,KAChFxC,IAAI,CAACoC,WAAW,CAAC,CAAC,CAAC,EAAErC,OAAO,CAAC,EAAE;MAC7ByC,QAAQ,EAAEA;KACX,CAAC;IACJ,MAAMC,IAAI,GAAGA,CAACF,OAAe,EAAExC,OAAU,EAAEyC,QAAiC,KAC1E1D,MAAM,CAACmD,IAAI,CAAC,MAAMK,UAAU,CAAC,CAAC,EAAEvC,OAAO,EAAEyC,QAAQ,CAAC,CAAC;IACrD,OAAOvD,QAAQ,CAAsC;MAAEgB,GAAG;MAAEwC,IAAI;MAAEH;IAAU,CAAE,CAAC;EACjF,CAAC;CACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"BunWorkerRunner.js","names":["Cause","Deferred","Effect","Exit","Fiber","identity","Layer","Scope","WorkerError","WorkerReceiveError","WorkerSpawnError","WorkerRunner","layer","succeed","WorkerRunnerPlatform","start","fnUntraced","self","reason","message","port","run","handler","scopedWith","scope","closeLatch","makeUnsafe","trackFiber","runIn","services","context","runFork","runForkWith","onExit","exit","_tag","hasInterruptsOnly","cause","logError","onMessage","event","data","result","isEffect","fiber","addObserver","close","doneUnsafe","void","onMessageError","error","onError","addFinalizer","sync","removeEventListener","addEventListener","postMessage","await","sendUnsafe","_portId","transfer","send"],"sources":["../src/BunWorkerRunner.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;AAWA,OAAO,KAAKA,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,QAAQ,MAAM,iBAAiB;AAC3C,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,IAAI,MAAM,aAAa;AACnC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,SAAS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7B,IAAI,CAACoC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;MAErB,OAAO,OAAOvD,QAAQ,CAACwD,KAAK,CAAChC,UAAU,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEL,MAAMiC,UAAU,GAAGA,CAACC,OAAe,EAAExC,OAAU,EAAEyC,QAAiC,KAChFxC,IAAI,CAACoC,WAAW,CAAC,CAAC,CAAC,EAAErC,OAAO,CAAC,EAAE;MAC7ByC,QAAQ,EAAEA;KACX,CAAC;IACJ,MAAMC,IAAI,GAAGA,CAACF,OAAe,EAAExC,OAAU,EAAEyC,QAAiC,KAC1E1D,MAAM,CAACmD,IAAI,CAAC,MAAMK,UAAU,CAAC,CAAC,EAAEvC,OAAO,EAAEyC,QAAQ,CAAC,CAAC;IACrD,OAAOvD,QAAQ,CAAsC;MAAEgB,GAAG;MAAEwC,IAAI;MAAEH;IAAU,CAAE,CAAC;EACjF,CAAC;CACF,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@effect/platform-bun",
3
3
  "type": "module",
4
- "version": "4.0.0-beta.78",
4
+ "version": "4.0.0-beta.79",
5
5
  "license": "MIT",
6
6
  "description": "Platform specific implementations for the Bun runtime",
7
7
  "homepage": "https://effect.website",
@@ -45,14 +45,14 @@
45
45
  "provenance": true
46
46
  },
47
47
  "peerDependencies": {
48
- "effect": "^4.0.0-beta.78"
48
+ "effect": "^4.0.0-beta.79"
49
49
  },
50
50
  "dependencies": {
51
- "@effect/platform-node-shared": "^4.0.0-beta.78"
51
+ "@effect/platform-node-shared": "^4.0.0-beta.79"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/bun": "^1.3.13",
55
- "effect": "^4.0.0-beta.78"
55
+ "effect": "^4.0.0-beta.79"
56
56
  },
57
57
  "scripts": {
58
58
  "codegen": "effect-utils codegen",
@@ -1,36 +1,10 @@
1
1
  /**
2
- * The `BunClusterHttp` module provides the Bun HTTP and WebSocket transports
3
- * for Effect Cluster runners. It wires `HttpRunner` to the Bun HTTP server,
4
- * supplies Fetch and Bun WebSocket client protocols, and builds a complete
5
- * sharding layer with serialization, runner health, runner storage, and message
6
- * storage.
2
+ * Bun HTTP and WebSocket layers for Effect Cluster runners.
7
3
  *
8
- * **Common tasks**
9
- *
10
- * - Run a Bun process as a cluster runner over HTTP or WebSocket with
11
- * {@link layer}
12
- * - Connect a client-only process to an existing HTTP cluster without starting
13
- * a runner server
14
- * - Use SQL-backed storage for durable multi-process clusters, `local` storage
15
- * for short-lived development, or `byo` storage when the deployment owns the
16
- * persistence boundary
17
- * - Check runner health with protocol pings or Kubernetes pod readiness through
18
- * {@link layerK8sHttpClient}
19
- *
20
- * **Gotchas**
21
- *
22
- * - `runnerAddress` is the host and port advertised to other runners; set
23
- * `runnerListenAddress` when the local bind address differs from the
24
- * externally reachable address
25
- * - The HTTP and WebSocket transports serve runner RPCs at the default
26
- * `HttpRunner` route, so proxies and load balancers must preserve the path
27
- * and allow WebSocket upgrades when `transport` is `"websocket"`
28
- * - `clientOnly` does not start an HTTP server or receive shard assignments
29
- * - SQL storage is the default; `local` storage is in-memory/noop and `byo`
30
- * requires the surrounding application to provide both runner and message
31
- * storage services
32
- * - Ping health checks use the selected transport and serialization, so route,
33
- * port, proxy, or codec mismatches can make a runner appear unhealthy
4
+ * `layerHttpServer` provides the Bun HTTP server used by cluster runners. The
5
+ * main `layer` builds a sharding layer for HTTP or WebSocket transport,
6
+ * choosing serialization, runner health checks, runner storage, message
7
+ * storage, and optional client-only mode from the supplied options.
34
8
  *
35
9
  * @since 4.0.0
36
10
  */
@@ -1,38 +1,11 @@
1
1
  /**
2
- * The `BunClusterSocket` module provides the Bun socket transport for Effect
3
- * Cluster runners. It wires `SocketRunner` to Bun-compatible TCP sockets,
4
- * supplies RPC client and server protocol layers, and builds a complete
5
- * sharding layer with serialization, runner health, runner storage, and message
6
- * storage.
2
+ * Bun socket layers for Effect Cluster runners.
7
3
  *
8
- * **Common tasks**
9
- *
10
- * - Run a Bun process as a cluster runner over raw TCP sockets with
11
- * {@link layer}
12
- * - Connect a client-only process to an existing socket cluster without
13
- * starting a runner server
14
- * - Use SQL-backed storage for durable multi-process clusters, `local` storage
15
- * for short-lived development, or `byo` storage when the deployment owns the
16
- * persistence boundary
17
- * - Check runner health with socket pings or Kubernetes pod readiness through
18
- * {@link layerK8sHttpClient}
19
- *
20
- * **Gotchas**
21
- *
22
- * - `runnerAddress` is the host and port advertised to other runners; set
23
- * `runnerListenAddress` when the local bind address differs from the
24
- * externally reachable address
25
- * - The socket transport is point-to-point RPC, not cluster gossip: runner
26
- * membership, shard ownership, and persisted delivery are coordinated through
27
- * `RunnerStorage`, `MessageStorage`, and `RunnerHealth`
28
- * - `clientOnly` does not start a socket server or receive shard assignments
29
- * - SQL storage is the default; `local` storage is in-memory/noop and `byo`
30
- * requires the surrounding application to provide both runner and message
31
- * storage services
32
- * - Ping health checks use the same socket protocol, so unreachable ports,
33
- * firewalls, or serialization mismatches can make a runner appear unhealthy
34
- * - Kubernetes health checks use Bun's Fetch-backed HTTP client and the service
35
- * account CA certificate when it is available
4
+ * The main `layer` builds a sharding layer for socket transport, choosing
5
+ * serialization, runner health checks, runner storage, message storage, and
6
+ * optional client-only mode from the supplied options. This module also
7
+ * re-exports the shared socket client and server protocol layers and provides
8
+ * `layerK8sHttpClient` for Kubernetes runner health checks.
36
9
  *
37
10
  * @since 4.0.0
38
11
  */