@effect/platform-bun 4.0.0-beta.10 → 4.0.0-beta.100

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 (109) hide show
  1. package/README.md +1 -1
  2. package/dist/BunChildProcessSpawner.d.ts +2 -2
  3. package/dist/BunChildProcessSpawner.js +2 -2
  4. package/dist/BunClusterHttp.d.ts +44 -7
  5. package/dist/BunClusterHttp.d.ts.map +1 -1
  6. package/dist/BunClusterHttp.js +41 -10
  7. package/dist/BunClusterHttp.js.map +1 -1
  8. package/dist/BunClusterSocket.d.ts +27 -9
  9. package/dist/BunClusterSocket.d.ts.map +1 -1
  10. package/dist/BunClusterSocket.js +27 -9
  11. package/dist/BunClusterSocket.js.map +1 -1
  12. package/dist/BunCrypto.d.ts +10 -0
  13. package/dist/BunCrypto.d.ts.map +1 -0
  14. package/dist/BunCrypto.js +22 -0
  15. package/dist/BunCrypto.js.map +1 -0
  16. package/dist/BunFileSystem.d.ts +4 -2
  17. package/dist/BunFileSystem.d.ts.map +1 -1
  18. package/dist/BunFileSystem.js +11 -3
  19. package/dist/BunFileSystem.js.map +1 -1
  20. package/dist/BunHttpClient.d.ts +2 -2
  21. package/dist/BunHttpClient.js +2 -2
  22. package/dist/BunHttpPlatform.d.ts +4 -2
  23. package/dist/BunHttpPlatform.d.ts.map +1 -1
  24. package/dist/BunHttpPlatform.js +5 -3
  25. package/dist/BunHttpPlatform.js.map +1 -1
  26. package/dist/BunHttpServer.d.ts +58 -21
  27. package/dist/BunHttpServer.d.ts.map +1 -1
  28. package/dist/BunHttpServer.js +63 -36
  29. package/dist/BunHttpServer.js.map +1 -1
  30. package/dist/BunHttpServerRequest.d.ts +11 -3
  31. package/dist/BunHttpServerRequest.d.ts.map +1 -1
  32. package/dist/BunHttpServerRequest.js +4 -2
  33. package/dist/BunHttpServerRequest.js.map +1 -1
  34. package/dist/BunMultipart.d.ts +16 -5
  35. package/dist/BunMultipart.d.ts.map +1 -1
  36. package/dist/BunMultipart.js +15 -5
  37. package/dist/BunMultipart.js.map +1 -1
  38. package/dist/BunPath.d.ts +12 -6
  39. package/dist/BunPath.d.ts.map +1 -1
  40. package/dist/BunPath.js +20 -7
  41. package/dist/BunPath.js.map +1 -1
  42. package/dist/BunRedis.d.ts +23 -9
  43. package/dist/BunRedis.d.ts.map +1 -1
  44. package/dist/BunRedis.js +26 -12
  45. package/dist/BunRedis.js.map +1 -1
  46. package/dist/BunRuntime.d.ts +21 -30
  47. package/dist/BunRuntime.d.ts.map +1 -1
  48. package/dist/BunRuntime.js +14 -11
  49. package/dist/BunRuntime.js.map +1 -1
  50. package/dist/BunServices.d.ts +19 -5
  51. package/dist/BunServices.d.ts.map +1 -1
  52. package/dist/BunServices.js +7 -3
  53. package/dist/BunServices.js.map +1 -1
  54. package/dist/BunSink.d.ts +2 -2
  55. package/dist/BunSink.js +2 -2
  56. package/dist/BunSocket.d.ts +18 -4
  57. package/dist/BunSocket.d.ts.map +1 -1
  58. package/dist/BunSocket.js +10 -3
  59. package/dist/BunSocket.js.map +1 -1
  60. package/dist/BunSocketServer.d.ts +2 -2
  61. package/dist/BunSocketServer.js +2 -2
  62. package/dist/BunStdio.d.ts +5 -2
  63. package/dist/BunStdio.d.ts.map +1 -1
  64. package/dist/BunStdio.js +13 -3
  65. package/dist/BunStdio.js.map +1 -1
  66. package/dist/BunStream.d.ts +5 -4
  67. package/dist/BunStream.d.ts.map +1 -1
  68. package/dist/BunStream.js +28 -20
  69. package/dist/BunStream.js.map +1 -1
  70. package/dist/BunTerminal.d.ts +8 -2
  71. package/dist/BunTerminal.d.ts.map +1 -1
  72. package/dist/BunTerminal.js +15 -3
  73. package/dist/BunTerminal.js.map +1 -1
  74. package/dist/BunWorker.d.ts +9 -2
  75. package/dist/BunWorker.d.ts.map +1 -1
  76. package/dist/BunWorker.js +20 -4
  77. package/dist/BunWorker.js.map +1 -1
  78. package/dist/BunWorkerRunner.d.ts +5 -1
  79. package/dist/BunWorkerRunner.d.ts.map +1 -1
  80. package/dist/BunWorkerRunner.js +17 -5
  81. package/dist/BunWorkerRunner.js.map +1 -1
  82. package/dist/index.d.ts +25 -23
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +25 -23
  85. package/dist/index.js.map +1 -1
  86. package/package.json +7 -8
  87. package/src/BunChildProcessSpawner.ts +2 -2
  88. package/src/BunClusterHttp.ts +49 -11
  89. package/src/BunClusterSocket.ts +27 -9
  90. package/src/BunCrypto.ts +24 -0
  91. package/src/BunFileSystem.ts +11 -3
  92. package/src/BunHttpClient.ts +2 -2
  93. package/src/BunHttpPlatform.ts +14 -4
  94. package/src/BunHttpServer.ts +108 -57
  95. package/src/BunHttpServerRequest.ts +11 -3
  96. package/src/BunMultipart.ts +24 -6
  97. package/src/BunPath.ts +20 -7
  98. package/src/BunRedis.ts +28 -14
  99. package/src/BunRuntime.ts +28 -31
  100. package/src/BunServices.ts +21 -5
  101. package/src/BunSink.ts +2 -2
  102. package/src/BunSocket.ts +18 -4
  103. package/src/BunSocketServer.ts +2 -2
  104. package/src/BunStdio.ts +13 -3
  105. package/src/BunStream.ts +31 -23
  106. package/src/BunTerminal.ts +15 -3
  107. package/src/BunWorker.ts +20 -4
  108. package/src/BunWorkerRunner.ts +17 -5
  109. package/src/index.ts +26 -23
@@ -1,5 +1,13 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Worker-entrypoint support for Bun worker runners.
3
+ *
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.
9
+ *
10
+ * @since 4.0.0
3
11
  */
4
12
  import * as Cause from "effect/Cause"
5
13
  import * as Deferred from "effect/Deferred"
@@ -15,8 +23,12 @@ import * as WorkerRunner from "effect/unstable/workers/WorkerRunner"
15
23
  declare const self: MessagePort
16
24
 
17
25
  /**
18
- * @since 1.0.0
26
+ * Provides the `WorkerRunnerPlatform` for code running inside a Bun worker,
27
+ * routing parent messages to the registered handler and sending responses back
28
+ * through the worker port.
29
+ *
19
30
  * @category layers
31
+ * @since 4.0.0
20
32
  */
21
33
  export const layer: Layer.Layer<WorkerRunner.WorkerRunnerPlatform> = Layer.succeed(WorkerRunner.WorkerRunnerPlatform)({
22
34
  start: Effect.fnUntraced(function*<O = unknown, I = unknown>() {
@@ -32,7 +44,7 @@ export const layer: Layer.Layer<WorkerRunner.WorkerRunnerPlatform> = Layer.succe
32
44
  Effect.scopedWith(Effect.fnUntraced(function*(scope) {
33
45
  const closeLatch = Deferred.makeUnsafe<void, WorkerError>()
34
46
  const trackFiber = Fiber.runIn(scope)
35
- const services = yield* Effect.services<R>()
47
+ const services = yield* Effect.context<R>()
36
48
  const runFork = Effect.runForkWith(services)
37
49
  const onExit = (exit: Exit.Exit<any, E>) => {
38
50
  if (exit._tag === "Failure" && !Cause.hasInterruptsOnly(exit.cause)) {
@@ -62,7 +74,7 @@ export const layer: Layer.Layer<WorkerRunner.WorkerRunnerPlatform> = Layer.succe
62
74
  message: "received messageerror event",
63
75
  cause: error.data
64
76
  })
65
- }).asEffect()
77
+ })
66
78
  )
67
79
  }
68
80
  function onError(error: MessageEvent) {
@@ -73,7 +85,7 @@ export const layer: Layer.Layer<WorkerRunner.WorkerRunnerPlatform> = Layer.succe
73
85
  message: "received error event",
74
86
  cause: error.data
75
87
  })
76
- }).asEffect()
88
+ })
77
89
  )
78
90
  }
79
91
  yield* Scope.addFinalizer(
package/src/index.ts CHANGED
@@ -1,112 +1,115 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * @since 4.0.0
3
3
  */
4
4
 
5
5
  // @barrel: Auto-generated exports. Do not edit manually.
6
6
 
7
7
  /**
8
- * Node.js implementation of `ChildProcessSpawner`.
9
- *
10
- * @since 1.0.0
8
+ * @since 4.0.0
11
9
  */
12
10
  export * as BunChildProcessSpawner from "./BunChildProcessSpawner.ts"
13
11
 
14
12
  /**
15
- * @since 1.0.0
13
+ * @since 4.0.0
16
14
  */
17
15
  export * as BunClusterHttp from "./BunClusterHttp.ts"
18
16
 
19
17
  /**
20
- * @since 1.0.0
18
+ * @since 4.0.0
21
19
  */
22
20
  export * as BunClusterSocket from "./BunClusterSocket.ts"
23
21
 
24
22
  /**
25
23
  * @since 1.0.0
26
24
  */
25
+ export * as BunCrypto from "./BunCrypto.ts"
26
+
27
+ /**
28
+ * @since 4.0.0
29
+ */
27
30
  export * as BunFileSystem from "./BunFileSystem.ts"
28
31
 
29
32
  /**
30
- * @since 1.0.0
33
+ * @since 4.0.0
31
34
  */
32
35
  export * as BunHttpClient from "./BunHttpClient.ts"
33
36
 
34
37
  /**
35
- * @since 1.0.0
38
+ * @since 4.0.0
36
39
  */
37
40
  export * as BunHttpPlatform from "./BunHttpPlatform.ts"
38
41
 
39
42
  /**
40
- * @since 1.0.0
43
+ * @since 4.0.0
41
44
  */
42
45
  export * as BunHttpServer from "./BunHttpServer.ts"
43
46
 
44
47
  /**
45
- * @since 1.0.0
48
+ * @since 4.0.0
46
49
  */
47
50
  export * as BunHttpServerRequest from "./BunHttpServerRequest.ts"
48
51
 
49
52
  /**
50
- * @since 1.0.0
53
+ * @since 4.0.0
51
54
  */
52
55
  export * as BunMultipart from "./BunMultipart.ts"
53
56
 
54
57
  /**
55
- * @since 1.0.0
58
+ * @since 4.0.0
56
59
  */
57
60
  export * as BunPath from "./BunPath.ts"
58
61
 
59
62
  /**
60
- * @since 1.0.0
63
+ * @since 4.0.0
61
64
  */
62
65
  export * as BunRedis from "./BunRedis.ts"
63
66
 
64
67
  /**
65
- * @since 1.0.0
68
+ * @since 4.0.0
66
69
  */
67
70
  export * as BunRuntime from "./BunRuntime.ts"
68
71
 
69
72
  /**
70
- * @since 1.0.0
73
+ * @since 4.0.0
71
74
  */
72
75
  export * as BunServices from "./BunServices.ts"
73
76
 
74
77
  /**
75
- * @since 1.0.0
78
+ * @since 4.0.0
76
79
  */
77
80
  export * as BunSink from "./BunSink.ts"
78
81
 
79
82
  /**
80
- * @since 1.0.0
83
+ * @since 4.0.0
81
84
  */
82
85
  export * as BunSocket from "./BunSocket.ts"
83
86
 
84
87
  /**
85
- * @since 1.0.0
88
+ * @since 4.0.0
86
89
  */
87
90
  export * as BunSocketServer from "./BunSocketServer.ts"
88
91
 
89
92
  /**
90
- * @since 1.0.0
93
+ * @since 4.0.0
91
94
  */
92
95
  export * as BunStdio from "./BunStdio.ts"
93
96
 
94
97
  /**
95
- * @since 1.0.0
98
+ * @since 4.0.0
96
99
  */
97
100
  export * as BunStream from "./BunStream.ts"
98
101
 
99
102
  /**
100
- * @since 1.0.0
103
+ * @since 4.0.0
101
104
  */
102
105
  export * as BunTerminal from "./BunTerminal.ts"
103
106
 
104
107
  /**
105
- * @since 1.0.0
108
+ * @since 4.0.0
106
109
  */
107
110
  export * as BunWorker from "./BunWorker.ts"
108
111
 
109
112
  /**
110
- * @since 1.0.0
113
+ * @since 4.0.0
111
114
  */
112
115
  export * as BunWorkerRunner from "./BunWorkerRunner.ts"