@effect/platform-bun 4.0.0-beta.66 → 4.0.0-beta.68

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 (108) hide show
  1. package/dist/BunChildProcessSpawner.d.ts +1 -1
  2. package/dist/BunChildProcessSpawner.js +1 -1
  3. package/dist/BunClusterHttp.d.ts +44 -7
  4. package/dist/BunClusterHttp.d.ts.map +1 -1
  5. package/dist/BunClusterHttp.js +10 -6
  6. package/dist/BunClusterHttp.js.map +1 -1
  7. package/dist/BunClusterSocket.d.ts +48 -9
  8. package/dist/BunClusterSocket.d.ts.map +1 -1
  9. package/dist/BunClusterSocket.js +48 -9
  10. package/dist/BunClusterSocket.js.map +1 -1
  11. package/dist/BunCrypto.d.ts +10 -0
  12. package/dist/BunCrypto.d.ts.map +1 -0
  13. package/dist/BunCrypto.js +14 -0
  14. package/dist/BunCrypto.js.map +1 -0
  15. package/dist/BunFileSystem.d.ts +4 -2
  16. package/dist/BunFileSystem.d.ts.map +1 -1
  17. package/dist/BunFileSystem.js +27 -3
  18. package/dist/BunFileSystem.js.map +1 -1
  19. package/dist/BunHttpClient.d.ts +2 -2
  20. package/dist/BunHttpClient.js +2 -2
  21. package/dist/BunHttpPlatform.d.ts +4 -2
  22. package/dist/BunHttpPlatform.d.ts.map +1 -1
  23. package/dist/BunHttpPlatform.js +5 -3
  24. package/dist/BunHttpPlatform.js.map +1 -1
  25. package/dist/BunHttpServer.d.ts +59 -14
  26. package/dist/BunHttpServer.d.ts.map +1 -1
  27. package/dist/BunHttpServer.js +24 -12
  28. package/dist/BunHttpServer.js.map +1 -1
  29. package/dist/BunHttpServerRequest.d.ts +26 -2
  30. package/dist/BunHttpServerRequest.d.ts.map +1 -1
  31. package/dist/BunHttpServerRequest.js +3 -1
  32. package/dist/BunHttpServerRequest.js.map +1 -1
  33. package/dist/BunMultipart.d.ts +28 -5
  34. package/dist/BunMultipart.d.ts.map +1 -1
  35. package/dist/BunMultipart.js +8 -4
  36. package/dist/BunMultipart.js.map +1 -1
  37. package/dist/BunPath.d.ts +12 -6
  38. package/dist/BunPath.d.ts.map +1 -1
  39. package/dist/BunPath.js +30 -7
  40. package/dist/BunPath.js.map +1 -1
  41. package/dist/BunRedis.d.ts +37 -7
  42. package/dist/BunRedis.d.ts.map +1 -1
  43. package/dist/BunRedis.js +37 -7
  44. package/dist/BunRedis.js.map +1 -1
  45. package/dist/BunRuntime.d.ts +6 -6
  46. package/dist/BunRuntime.d.ts.map +1 -1
  47. package/dist/BunRuntime.js +19 -3
  48. package/dist/BunRuntime.js.map +1 -1
  49. package/dist/BunServices.d.ts +32 -5
  50. package/dist/BunServices.d.ts.map +1 -1
  51. package/dist/BunServices.js +7 -3
  52. package/dist/BunServices.js.map +1 -1
  53. package/dist/BunSink.d.ts +2 -2
  54. package/dist/BunSink.js +2 -2
  55. package/dist/BunSocket.d.ts +30 -4
  56. package/dist/BunSocket.d.ts.map +1 -1
  57. package/dist/BunSocket.js +10 -3
  58. package/dist/BunSocket.js.map +1 -1
  59. package/dist/BunSocketServer.d.ts +2 -2
  60. package/dist/BunSocketServer.js +2 -2
  61. package/dist/BunStdio.d.ts +5 -2
  62. package/dist/BunStdio.d.ts.map +1 -1
  63. package/dist/BunStdio.js +24 -3
  64. package/dist/BunStdio.js.map +1 -1
  65. package/dist/BunStream.d.ts +3 -2
  66. package/dist/BunStream.d.ts.map +1 -1
  67. package/dist/BunStream.js +25 -3
  68. package/dist/BunStream.js.map +1 -1
  69. package/dist/BunTerminal.d.ts +8 -2
  70. package/dist/BunTerminal.d.ts.map +1 -1
  71. package/dist/BunTerminal.js +23 -3
  72. package/dist/BunTerminal.js.map +1 -1
  73. package/dist/BunWorker.d.ts +9 -2
  74. package/dist/BunWorker.d.ts.map +1 -1
  75. package/dist/BunWorker.js +28 -3
  76. package/dist/BunWorker.js.map +1 -1
  77. package/dist/BunWorkerRunner.d.ts +5 -1
  78. package/dist/BunWorkerRunner.d.ts.map +1 -1
  79. package/dist/BunWorkerRunner.js +24 -2
  80. package/dist/BunWorkerRunner.js.map +1 -1
  81. package/dist/index.d.ts +396 -21
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +396 -21
  84. package/dist/index.js.map +1 -1
  85. package/package.json +5 -5
  86. package/src/BunChildProcessSpawner.ts +1 -1
  87. package/src/BunClusterHttp.ts +44 -7
  88. package/src/BunClusterSocket.ts +48 -9
  89. package/src/BunCrypto.ts +16 -0
  90. package/src/BunFileSystem.ts +27 -3
  91. package/src/BunHttpClient.ts +2 -2
  92. package/src/BunHttpPlatform.ts +28 -4
  93. package/src/BunHttpServer.ts +59 -14
  94. package/src/BunHttpServerRequest.ts +26 -2
  95. package/src/BunMultipart.ts +28 -5
  96. package/src/BunPath.ts +30 -7
  97. package/src/BunRedis.ts +37 -7
  98. package/src/BunRuntime.ts +23 -7
  99. package/src/BunServices.ts +34 -5
  100. package/src/BunSink.ts +2 -2
  101. package/src/BunSocket.ts +30 -4
  102. package/src/BunSocketServer.ts +2 -2
  103. package/src/BunStdio.ts +24 -3
  104. package/src/BunStream.ts +25 -3
  105. package/src/BunTerminal.ts +23 -3
  106. package/src/BunWorker.ts +28 -3
  107. package/src/BunWorkerRunner.ts +24 -2
  108. package/src/index.ts +397 -21
package/dist/BunRedis.js CHANGED
@@ -1,5 +1,29 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Bun Redis integration backed by Bun's built-in `RedisClient`.
3
+ *
4
+ * This module provides scoped layers that create a Bun `RedisClient` and expose
5
+ * both the low-level `Redis` service used by Effect persistence modules and the
6
+ * `BunRedis` service for direct access to the underlying client. Use it in Bun
7
+ * applications that need Redis-backed persistence, persisted queues,
8
+ * distributed rate limiting, custom Redis commands, or Bun Redis features such
9
+ * as pub/sub through the raw client.
10
+ *
11
+ * The client is acquired when the layer is built and closed with `close` when
12
+ * the layer scope ends, so install the layer at the lifetime you want for the
13
+ * connection and pass a Redis URL, Bun `RedisOptions`, or `layerConfig` for
14
+ * connection settings. The portable `Redis` service sends ordinary commands
15
+ * through `RedisClient.send`; pub/sub is available through `BunRedis.client`
16
+ * or `BunRedis.use` and should normally use a separately scoped client so a
17
+ * subscription does not interfere with command traffic used by persistence or
18
+ * rate limiter stores.
19
+ *
20
+ * Persistence and rate limiter stores build keys and Lua scripts on top of this
21
+ * service. Choose stable prefixes and store ids to avoid collisions, account
22
+ * for persisted values that may fail to decode after schema changes, and avoid
23
+ * unbounded high-cardinality rate-limit keys unless you have a cleanup or
24
+ * bounding strategy.
25
+ *
26
+ * @since 4.0.0
3
27
  */
4
28
  import { RedisClient } from "bun";
5
29
  import * as Config from "effect/Config";
@@ -10,8 +34,10 @@ import * as Layer from "effect/Layer";
10
34
  import * as Scope from "effect/Scope";
11
35
  import * as Redis from "effect/unstable/persistence/Redis";
12
36
  /**
13
- * @since 1.0.0
14
- * @category Service
37
+ * Service tag for Bun Redis integration, exposing the raw `RedisClient` and a `use` helper that maps client promise failures to `RedisError`.
38
+ *
39
+ * @category services
40
+ * @since 4.0.0
15
41
  */
16
42
  export class BunRedis extends /*#__PURE__*/Context.Service()("@effect/platform-bun/BunRedis") {}
17
43
  const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
@@ -39,13 +65,17 @@ const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
39
65
  return Context.make(BunRedis, bunRedis).pipe(Context.add(Redis.Redis, redis));
40
66
  });
41
67
  /**
42
- * @since 1.0.0
43
- * @category Layers
68
+ * Creates scoped Bun Redis layers for `Redis.Redis` and `BunRedis`, closing the underlying client when the scope finalizes.
69
+ *
70
+ * @category layers
71
+ * @since 4.0.0
44
72
  */
45
73
  export const layer = options => Layer.effectContext(make(options));
46
74
  /**
47
- * @since 1.0.0
48
- * @category Layers
75
+ * Creates scoped Bun Redis layers from configurable Redis options, closing the underlying client when the scope finalizes.
76
+ *
77
+ * @category layers
78
+ * @since 4.0.0
49
79
  */
50
80
  export const layerConfig = options => Layer.effectContext(Config.unwrap(options).pipe(Effect.flatMap(make)));
51
81
  //# sourceMappingURL=BunRedis.js.map
@@ -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;;;AAGA,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;;;;AAIA,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,GAAG,OAAOV,MAAM,CAACU,KAAK;EACjC,OAAOP,KAAK,CAACQ,YAAY,CAACD,KAAK,EAAEV,MAAM,CAACY,IAAI,CAAC,MAAMC,MAAM,CAACC,KAAK,EAAE,CAAC,CAAC;EACnE,MAAMD,MAAM,GAAG,IAAIhB,WAAW,CAACY,OAAO,EAAEM,GAAG,EAAEN,OAAO,CAAC;EAErD,MAAMO,GAAG,GAAOC,CAAsC,IACpDjB,MAAM,CAACkB,UAAU,CAAC;IAChBC,GAAG,EAAEA,CAAA,KAAMF,CAAC,CAACJ,MAAM,CAAC;IACpBO,KAAK,EAAGC,KAAK,IAAK,IAAIjB,KAAK,CAACkB,UAAU,CAAC;MAAED;IAAK,CAAE;GACjD,CAAC;EAEJ,MAAME,KAAK,GAAG,OAAOnB,KAAK,CAACG,IAAI,CAAC;IAC9BiB,IAAI,EAAEA,CAAcC,OAAe,EAAE,GAAGC,IAA2B,KACjE1B,MAAM,CAACkB,UAAU,CAAC;MAChBC,GAAG,EAAEA,CAAA,KAAMN,MAAM,CAACW,IAAI,CAACC,OAAO,EAAEC,IAAqB,CAAe;MACpEN,KAAK,EAAGC,KAAK,IAAK,IAAIjB,KAAK,CAACkB,UAAU,CAAC;QAAED;MAAK,CAAE;KACjD;GACJ,CAAC;EAEF,MAAMM,QAAQ,GAAG1B,EAAE,CAAC2B,QAAQ,CAAsB;IAChDf,MAAM;IACNG;GACD,CAAC;EAEF,OAAOjB,OAAO,CAACQ,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;;;;AAIA,OAAO,MAAMQ,KAAK,GAChBtB,OAAgE,IACxBP,KAAK,CAAC8B,aAAa,CAACzB,IAAI,CAACE,OAAO,CAAC,CAAC;AAE5E;;;;AAIA,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;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,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,GAAG,OAAOV,MAAM,CAACU,KAAK;EACjC,OAAOP,KAAK,CAACQ,YAAY,CAACD,KAAK,EAAEV,MAAM,CAACY,IAAI,CAAC,MAAMC,MAAM,CAACC,KAAK,EAAE,CAAC,CAAC;EACnE,MAAMD,MAAM,GAAG,IAAIhB,WAAW,CAACY,OAAO,EAAEM,GAAG,EAAEN,OAAO,CAAC;EAErD,MAAMO,GAAG,GAAOC,CAAsC,IACpDjB,MAAM,CAACkB,UAAU,CAAC;IAChBC,GAAG,EAAEA,CAAA,KAAMF,CAAC,CAACJ,MAAM,CAAC;IACpBO,KAAK,EAAGC,KAAK,IAAK,IAAIjB,KAAK,CAACkB,UAAU,CAAC;MAAED;IAAK,CAAE;GACjD,CAAC;EAEJ,MAAME,KAAK,GAAG,OAAOnB,KAAK,CAACG,IAAI,CAAC;IAC9BiB,IAAI,EAAEA,CAAcC,OAAe,EAAE,GAAGC,IAA2B,KACjE1B,MAAM,CAACkB,UAAU,CAAC;MAChBC,GAAG,EAAEA,CAAA,KAAMN,MAAM,CAACW,IAAI,CAACC,OAAO,EAAEC,IAAqB,CAAe;MACpEN,KAAK,EAAGC,KAAK,IAAK,IAAIjB,KAAK,CAACkB,UAAU,CAAC;QAAED;MAAK,CAAE;KACjD;GACJ,CAAC;EAEF,MAAMM,QAAQ,GAAG1B,EAAE,CAAC2B,QAAQ,CAAsB;IAChDf,MAAM;IACNG;GACD,CAAC;EAEF,OAAOjB,OAAO,CAACQ,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":[]}
@@ -24,8 +24,8 @@ import type { Teardown } from "effect/Runtime";
24
24
  * when you need structured error handling, log management, interrupt support,
25
25
  * or advanced teardown capabilities.
26
26
  *
27
- * @since 1.0.0
28
- * @category Run main
27
+ * @category running
28
+ * @since 4.0.0
29
29
  */
30
30
  export declare const runMain: {
31
31
  /**
@@ -52,8 +52,8 @@ export declare const runMain: {
52
52
  * when you need structured error handling, log management, interrupt support,
53
53
  * or advanced teardown capabilities.
54
54
  *
55
- * @since 1.0.0
56
- * @category Run main
55
+ * @category running
56
+ * @since 4.0.0
57
57
  */
58
58
  (options?: {
59
59
  readonly disableErrorReporting?: boolean | undefined;
@@ -83,8 +83,8 @@ export declare const runMain: {
83
83
  * when you need structured error handling, log management, interrupt support,
84
84
  * or advanced teardown capabilities.
85
85
  *
86
- * @since 1.0.0
87
- * @category Run main
86
+ * @category running
87
+ * @since 4.0.0
88
88
  */
89
89
  <E, A>(effect: Effect<A, E>, options?: {
90
90
  readonly disableErrorReporting?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"BunRuntime.d.ts","sourceRoot":"","sources":["../src/BunRuntime.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,OAAO,EAAE;IACpB;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;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;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;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":"AAoBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,OAAO,EAAE;IACpB;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;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;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;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,5 +1,21 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Bun entry-point helpers for running Effect programs.
3
+ *
4
+ * This module exposes `runMain`, the Bun runtime launcher used at the edge of
5
+ * CLIs, scripts, servers, and worker processes. It runs an already
6
+ * self-contained Effect as the process main program, using the shared
7
+ * Node-compatible runtime implementation for error reporting, teardown, and
8
+ * `process` signal handling available in Bun.
9
+ *
10
+ * `BunRuntime` does not provide application services by itself. Provide any
11
+ * required layers, such as `BunServices.layer` or narrower service-specific
12
+ * layers, before passing the effect to `runMain`. On `SIGINT` or `SIGTERM`,
13
+ * the main fiber is interrupted so scoped resources and finalizers can shut
14
+ * down; keep long-running servers, workers, and subscriptions attached to that
15
+ * scope and avoid finalizers that never complete, otherwise process shutdown
16
+ * can be delayed.
17
+ *
18
+ * @since 4.0.0
3
19
  */
4
20
  import * as NodeRuntime from "@effect/platform-node-shared/NodeRuntime";
5
21
  /**
@@ -26,8 +42,8 @@ import * as NodeRuntime from "@effect/platform-node-shared/NodeRuntime";
26
42
  * when you need structured error handling, log management, interrupt support,
27
43
  * or advanced teardown capabilities.
28
44
  *
29
- * @since 1.0.0
30
- * @category Run main
45
+ * @category running
46
+ * @since 4.0.0
31
47
  */
32
48
  export const runMain = NodeRuntime.runMain;
33
49
  //# sourceMappingURL=BunRuntime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BunRuntime.js","names":["NodeRuntime","runMain"],"sources":["../src/BunRuntime.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,WAAW,MAAM,0CAA0C;AAIvE;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,OAAO,MAAMC,OAAO,GAoEhBD,WAAW,CAACC,OAAO","ignoreList":[]}
1
+ {"version":3,"file":"BunRuntime.js","names":["NodeRuntime","runMain"],"sources":["../src/BunRuntime.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;AAmBA,OAAO,KAAKA,WAAW,MAAM,0CAA0C;AAIvE;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,OAAO,MAAMC,OAAO,GAoEhBD,WAAW,CAACC,OAAO","ignoreList":[]}
@@ -1,6 +1,27 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Provides the aggregate Bun platform services layer for applications that run
3
+ * on the Bun runtime.
4
+ *
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.
21
+ *
22
+ * @since 4.0.0
3
23
  */
24
+ import type { Crypto } from "effect/Crypto";
4
25
  import type { FileSystem } from "effect/FileSystem";
5
26
  import * as Layer from "effect/Layer";
6
27
  import type { Path } from "effect/Path";
@@ -8,13 +29,19 @@ import type { Stdio } from "effect/Stdio";
8
29
  import type { Terminal } from "effect/Terminal";
9
30
  import type { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
10
31
  /**
11
- * @since 1.0.0
32
+ * The union of core services provided by the Bun platform layer, including child
33
+ * process spawning, filesystem, path, stdio, and terminal services.
34
+ *
12
35
  * @category models
36
+ * @since 4.0.0
13
37
  */
14
- export type BunServices = ChildProcessSpawner | FileSystem | Path | Terminal | Stdio;
38
+ export type BunServices = ChildProcessSpawner | Crypto | FileSystem | Path | Terminal | Stdio;
15
39
  /**
16
- * @since 1.0.0
17
- * @category layer
40
+ * Provides the default Bun implementations for child process spawning,
41
+ * filesystem, path, stdio, and terminal services.
42
+ *
43
+ * @category layers
44
+ * @since 4.0.0
18
45
  */
19
46
  export declare const layer: Layer.Layer<BunServices>;
20
47
  //# sourceMappingURL=BunServices.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BunServices.d.ts","sourceRoot":"","sources":["../src/BunServices.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,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;AAOtF;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG,UAAU,GAAG,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAA;AAEpF;;;GAGG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAO1C,CAAA"}
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,12 +1,16 @@
1
1
  import * as Layer from "effect/Layer";
2
2
  import * as BunChildProcessSpawner from "./BunChildProcessSpawner.js";
3
+ import * as BunCrypto from "./BunCrypto.js";
3
4
  import * as BunFileSystem from "./BunFileSystem.js";
4
5
  import * as BunPath from "./BunPath.js";
5
6
  import * as BunStdio from "./BunStdio.js";
6
7
  import * as BunTerminal from "./BunTerminal.js";
7
8
  /**
8
- * @since 1.0.0
9
- * @category layer
9
+ * Provides the default Bun implementations for child process spawning,
10
+ * filesystem, path, stdio, and terminal services.
11
+ *
12
+ * @category layers
13
+ * @since 4.0.0
10
14
  */
11
- export const layer = /*#__PURE__*/BunChildProcessSpawner.layer.pipe(/*#__PURE__*/Layer.provideMerge(/*#__PURE__*/Layer.mergeAll(BunFileSystem.layer, BunPath.layer, BunStdio.layer, BunTerminal.layer)));
15
+ export const layer = /*#__PURE__*/BunChildProcessSpawner.layer.pipe(/*#__PURE__*/Layer.provideMerge(/*#__PURE__*/Layer.mergeAll(BunFileSystem.layer, BunCrypto.layer, BunPath.layer, BunStdio.layer, BunTerminal.layer)));
12
16
  //# sourceMappingURL=BunServices.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BunServices.js","names":["Layer","BunChildProcessSpawner","BunFileSystem","BunPath","BunStdio","BunTerminal","layer","pipe","provideMerge","mergeAll"],"sources":["../src/BunServices.ts"],"sourcesContent":[null],"mappings":"AAIA,OAAO,KAAKA,KAAK,MAAM,cAAc;AAKrC,OAAO,KAAKC,sBAAsB,MAAM,6BAA6B;AACrE,OAAO,KAAKC,aAAa,MAAM,oBAAoB;AACnD,OAAO,KAAKC,OAAO,MAAM,cAAc;AACvC,OAAO,KAAKC,QAAQ,MAAM,eAAe;AACzC,OAAO,KAAKC,WAAW,MAAM,kBAAkB;AAQ/C;;;;AAIA,OAAO,MAAMC,KAAK,gBAA6BL,sBAAsB,CAACK,KAAK,CAACC,IAAI,cAC9EP,KAAK,CAACQ,YAAY,cAACR,KAAK,CAACS,QAAQ,CAC/BP,aAAa,CAACI,KAAK,EACnBH,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":"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":[]}
package/dist/BunSink.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * @since 4.0.0
3
3
  */
4
4
  /**
5
- * @since 1.0.0
5
+ * @since 4.0.0
6
6
  */
7
7
  export * from "@effect/platform-node-shared/NodeSink";
8
8
  //# sourceMappingURL=BunSink.d.ts.map
package/dist/BunSink.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * @since 4.0.0
3
3
  */
4
4
  /**
5
- * @since 1.0.0
5
+ * @since 4.0.0
6
6
  */
7
7
  export * from "@effect/platform-node-shared/NodeSink";
8
8
  //# sourceMappingURL=BunSink.js.map
@@ -1,22 +1,48 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Bun platform socket entry point for Effect sockets backed by Bun-compatible
3
+ * Node streams and Bun's native WebSocket implementation.
4
+ *
5
+ * 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.
20
+ *
21
+ * @since 4.0.0
3
22
  */
4
23
  import type * as Duration from "effect/Duration";
5
24
  import type { Effect } from "effect/Effect";
6
25
  import * as Layer from "effect/Layer";
7
26
  import * as Socket from "effect/unstable/socket/Socket";
8
27
  /**
9
- * @since 1.0.0
28
+ * @since 4.0.0
10
29
  */
11
30
  export * from "@effect/platform-node-shared/NodeSocket";
12
31
  /**
13
- * @since 1.0.0
32
+ * Provides a `Socket.WebSocketConstructor` backed by Bun's global
33
+ * `WebSocket` implementation.
34
+ *
14
35
  * @category layers
36
+ * @since 4.0.0
15
37
  */
16
38
  export declare const layerWebSocketConstructor: Layer.Layer<Socket.WebSocketConstructor>;
17
39
  /**
18
- * @since 1.0.0
40
+ * Creates a `Socket.Socket` layer for a WebSocket URL using Bun's global
41
+ * `WebSocket` constructor, honoring protocol, open-timeout, and close-code
42
+ * error options.
43
+ *
19
44
  * @category layers
45
+ * @since 4.0.0
20
46
  */
21
47
  export declare const layerWebSocket: (url: string | Effect<string>, options?: {
22
48
  readonly closeCodeIsError?: ((code: number) => boolean) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"BunSocket.d.ts","sourceRoot":"","sources":["../src/BunSocket.ts"],"names":[],"mappings":"AAAA;;GAEG;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;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,KAAK,CACjD,MAAM,CAAC,oBAAoB,CAG5B,CAAA;AAED;;;GAGG;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;;;;;;;;;;;;;;;;;;;;;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"}
package/dist/BunSocket.js CHANGED
@@ -2,17 +2,24 @@ import { flow } from "effect/Function";
2
2
  import * as Layer from "effect/Layer";
3
3
  import * as Socket from "effect/unstable/socket/Socket";
4
4
  /**
5
- * @since 1.0.0
5
+ * @since 4.0.0
6
6
  */
7
7
  export * from "@effect/platform-node-shared/NodeSocket";
8
8
  /**
9
- * @since 1.0.0
9
+ * Provides a `Socket.WebSocketConstructor` backed by Bun's global
10
+ * `WebSocket` implementation.
11
+ *
10
12
  * @category layers
13
+ * @since 4.0.0
11
14
  */
12
15
  export const layerWebSocketConstructor = /*#__PURE__*/Layer.succeed(Socket.WebSocketConstructor)((url, protocols) => new globalThis.WebSocket(url, protocols));
13
16
  /**
14
- * @since 1.0.0
17
+ * Creates a `Socket.Socket` layer for a WebSocket URL using Bun's global
18
+ * `WebSocket` constructor, honoring protocol, open-timeout, and close-code
19
+ * error options.
20
+ *
15
21
  * @category layers
22
+ * @since 4.0.0
16
23
  */
17
24
  export const layerWebSocket = /*#__PURE__*/flow(Socket.makeWebSocket, /*#__PURE__*/Layer.effect(Socket.Socket), /*#__PURE__*/Layer.provide(layerWebSocketConstructor));
18
25
  //# sourceMappingURL=BunSocket.js.map
@@ -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":"AAKA,SAASA,IAAI,QAAQ,iBAAiB;AACtC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,MAAM,MAAM,+BAA+B;AAEvD;;;AAGA,cAAc,yCAAyC;AAEvD;;;;AAIA,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;;;;AAIA,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":"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,8 +1,8 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * @since 4.0.0
3
3
  */
4
4
  /**
5
- * @since 1.0.0
5
+ * @since 4.0.0
6
6
  */
7
7
  export * from "@effect/platform-node-shared/NodeSocketServer";
8
8
  //# sourceMappingURL=BunSocketServer.d.ts.map
@@ -1,8 +1,8 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * @since 4.0.0
3
3
  */
4
4
  /**
5
- * @since 1.0.0
5
+ * @since 4.0.0
6
6
  */
7
7
  export * from "@effect/platform-node-shared/NodeSocketServer";
8
8
  //# sourceMappingURL=BunSocketServer.js.map
@@ -1,8 +1,11 @@
1
1
  import type * as Layer from "effect/Layer";
2
2
  import type { Stdio } from "effect/Stdio";
3
3
  /**
4
- * @since 1.0.0
5
- * @category layer
4
+ * Provides the `Stdio` service backed by the current process arguments,
5
+ * stdin, stdout, and stderr streams.
6
+ *
7
+ * @category layers
8
+ * @since 4.0.0
6
9
  */
7
10
  export declare const layer: Layer.Layer<Stdio>;
8
11
  //# sourceMappingURL=BunStdio.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BunStdio.d.ts","sourceRoot":"","sources":["../src/BunStdio.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAEzC;;;GAGG;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":"AAsBA,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,10 +1,31 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Bun-backed implementation of Effect's `Stdio` service.
3
+ *
4
+ * This module provides the process stdio layer for Bun applications by reusing
5
+ * the shared Node-compatible implementation. The layer connects `Stdio` to the
6
+ * current Bun process: arguments come from `process.argv`, input is read from
7
+ * `process.stdin`, and output and error output write to `process.stdout` and
8
+ * `process.stderr`. It is intended for CLIs, scripts, command runners, test
9
+ * harnesses, and other process-oriented programs that need standard input and
10
+ * output through Effect services.
11
+ *
12
+ * The underlying stdio streams are global resources owned by the Bun process.
13
+ * The layer keeps stdin open and does not end stdout or stderr by default,
14
+ * which avoids closing handles that prompts, loggers, or other code may still
15
+ * use. Stdio may be attached to a TTY, pipe, or redirected file, so
16
+ * terminal-specific behavior such as raw mode, echo, colors, cursor control,
17
+ * and terminal dimensions should be coordinated with terminal APIs rather than
18
+ * assumed from this layer.
19
+ *
20
+ * @since 4.0.0
3
21
  */
4
22
  import * as NodeStdio from "@effect/platform-node-shared/NodeStdio";
5
23
  /**
6
- * @since 1.0.0
7
- * @category layer
24
+ * Provides the `Stdio` service backed by the current process arguments,
25
+ * stdin, stdout, and stderr streams.
26
+ *
27
+ * @category layers
28
+ * @since 4.0.0
8
29
  */
9
30
  export const layer = NodeStdio.layer;
10
31
  //# sourceMappingURL=BunStdio.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BunStdio.js","names":["NodeStdio","layer"],"sources":["../src/BunStdio.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,SAAS,MAAM,wCAAwC;AAInE;;;;AAIA,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;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAO,KAAKA,SAAS,MAAM,wCAAwC;AAInE;;;;;;;AAOA,OAAO,MAAMC,KAAK,GAAuBD,SAAS,CAACC,KAAK","ignoreList":[]}
@@ -1,14 +1,15 @@
1
1
  import type { LazyArg } from "effect/Function";
2
2
  import * as Stream from "effect/Stream";
3
3
  /**
4
- * @since 1.0.0
4
+ * @since 4.0.0
5
5
  */
6
6
  export * from "@effect/platform-node-shared/NodeStream";
7
7
  /**
8
8
  * An optimized version of `Stream.fromReadableStream` that uses the Bun
9
9
  * .readMany API to read multiple values at once from a `ReadableStream`.
10
10
  *
11
- * @since 1.0.0
11
+ * @category constructors
12
+ * @since 4.0.0
12
13
  */
13
14
  export declare const fromReadableStream: <A, E>(options: {
14
15
  readonly evaluate: LazyArg<ReadableStream<A>>;
@@ -1 +1 @@
1
- {"version":3,"file":"BunStream.d.ts","sourceRoot":"","sources":["../src/BunStream.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAG9C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC;;GAEG;AACH,cAAc,yCAAyC,CAAA;AAEvD;;;;;GAKG;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":"AA4BA,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
@@ -1,5 +1,26 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Bun stream interoperability for Effect streams.
3
+ *
4
+ * This module provides Bun-specific adapters for working with streaming data at
5
+ * the boundary between Bun APIs and Effect. It re-exports the shared Node stream
6
+ * adapters for Bun's Node-compatible stream APIs, and adds an optimized
7
+ * `ReadableStream` constructor that uses Bun's `readMany` support to pull
8
+ * batches of Web Stream values into an Effect `Stream`.
9
+ *
10
+ * Common uses include adapting Bun `Request` and `Response` bodies, multipart
11
+ * uploads, and other Web `ReadableStream` sources so they can be transformed,
12
+ * decoded, or piped with Effect stream operators. Pulling from the Effect stream
13
+ * drives reads from the underlying reader, while Bun and the Web Streams runtime
14
+ * still control their own internal buffering and source backpressure.
15
+ *
16
+ * Web `ReadableStream` readers take an exclusive lock on the source. Request and
17
+ * response bodies are also one-shot: once consumed they become disturbed and
18
+ * should not be read through another API. The adapter cancels the reader when
19
+ * the consuming scope is finalized by default; set `releaseLockOnEnd` when the
20
+ * stream is externally owned and should only have its lock released. Read errors
21
+ * are mapped through the provided `onError` function.
22
+ *
23
+ * @since 4.0.0
3
24
  */
4
25
  import * as Arr from "effect/Array";
5
26
  import * as Cause from "effect/Cause";
@@ -8,14 +29,15 @@ import * as Effect from "effect/Effect";
8
29
  import * as Scope from "effect/Scope";
9
30
  import * as Stream from "effect/Stream";
10
31
  /**
11
- * @since 1.0.0
32
+ * @since 4.0.0
12
33
  */
13
34
  export * from "@effect/platform-node-shared/NodeStream";
14
35
  /**
15
36
  * An optimized version of `Stream.fromReadableStream` that uses the Bun
16
37
  * .readMany API to read multiple values at once from a `ReadableStream`.
17
38
  *
18
- * @since 1.0.0
39
+ * @category constructors
40
+ * @since 4.0.0
19
41
  */
20
42
  export const fromReadableStream = options => Stream.fromChannel(Channel.fromTransform(Effect.fnUntraced(function* (_, scope) {
21
43
  const reader = options.evaluate().getReader();
@@ -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;;;AAGA,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;;;;;;AAMA,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;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,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":[]}
@@ -3,13 +3,19 @@ import type { Layer } from "effect/Layer";
3
3
  import type { Scope } from "effect/Scope";
4
4
  import type { Terminal, UserInput } from "effect/Terminal";
5
5
  /**
6
- * @since 1.0.0
6
+ * Creates a scoped `Terminal` service backed by process stdin/stdout, using the
7
+ * optional predicate to decide when key input should end the input stream.
8
+ *
7
9
  * @category constructors
10
+ * @since 4.0.0
8
11
  */
9
12
  export declare const make: (shouldQuit?: (input: UserInput) => boolean) => Effect<Terminal, never, Scope>;
10
13
  /**
11
- * @since 1.0.0
14
+ * Provides the default process-backed `Terminal` service, ending key input on
15
+ * the default quit keys.
16
+ *
12
17
  * @category layers
18
+ * @since 4.0.0
13
19
  */
14
20
  export declare const layer: Layer<Terminal>;
15
21
  //# sourceMappingURL=BunTerminal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BunTerminal.d.ts","sourceRoot":"","sources":["../src/BunTerminal.ts"],"names":[],"mappings":"AAIA,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;;;GAGG;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;;;GAGG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAsB,CAAA"}
1
+ {"version":3,"file":"BunTerminal.d.ts","sourceRoot":"","sources":["../src/BunTerminal.ts"],"names":[],"mappings":"AAkBA,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,15 +1,35 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Bun-backed implementation of Effect's `Terminal` service.
3
+ *
4
+ * This module provides a scoped, process-backed terminal for Bun programs by
5
+ * adapting the runtime's Node-compatible stdin, stdout, and `readline` support.
6
+ * It is useful for CLIs, prompts, REPLs, and terminal interfaces that need
7
+ * prompt output, line input, keypress input, or terminal dimensions.
8
+ *
9
+ * The service uses the current process streams, so acquire it with a scope or
10
+ * provide `layer` to ensure cleanup. When stdin is attached to a TTY, raw mode
11
+ * is enabled while the terminal is active and restored when the scope closes;
12
+ * this changes how keys are delivered and can affect other consumers of stdin.
13
+ * In pipes, redirected input, or CI, raw mode may be unavailable, keypress input
14
+ * is limited, and stdout dimensions may be reported as zero.
15
+ *
16
+ * @since 4.0.0
3
17
  */
4
18
  import * as NodeTerminal from "@effect/platform-node-shared/NodeTerminal";
5
19
  /**
6
- * @since 1.0.0
20
+ * Creates a scoped `Terminal` service backed by process stdin/stdout, using the
21
+ * optional predicate to decide when key input should end the input stream.
22
+ *
7
23
  * @category constructors
24
+ * @since 4.0.0
8
25
  */
9
26
  export const make = NodeTerminal.make;
10
27
  /**
11
- * @since 1.0.0
28
+ * Provides the default process-backed `Terminal` service, ending key input on
29
+ * the default quit keys.
30
+ *
12
31
  * @category layers
32
+ * @since 4.0.0
13
33
  */
14
34
  export const layer = NodeTerminal.layer;
15
35
  //# sourceMappingURL=BunTerminal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BunTerminal.js","names":["NodeTerminal","make","layer"],"sources":["../src/BunTerminal.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,YAAY,MAAM,2CAA2C;AAMzE;;;;AAIA,OAAO,MAAMC,IAAI,GAAmFD,YAAY,CAACC,IAAI;AAErH;;;;AAIA,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;;;;;;;;;;;;;;;;;AAiBA,OAAO,KAAKA,YAAY,MAAM,2CAA2C;AAMzE;;;;;;;AAOA,OAAO,MAAMC,IAAI,GAAmFD,YAAY,CAACC,IAAI;AAErH;;;;;;;AAOA,OAAO,MAAMC,KAAK,GAAoBF,YAAY,CAACE,KAAK","ignoreList":[]}