@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.
- package/README.md +1 -1
- package/dist/BunChildProcessSpawner.d.ts +2 -2
- package/dist/BunChildProcessSpawner.js +2 -2
- package/dist/BunClusterHttp.d.ts +44 -7
- package/dist/BunClusterHttp.d.ts.map +1 -1
- package/dist/BunClusterHttp.js +41 -10
- package/dist/BunClusterHttp.js.map +1 -1
- package/dist/BunClusterSocket.d.ts +27 -9
- package/dist/BunClusterSocket.d.ts.map +1 -1
- package/dist/BunClusterSocket.js +27 -9
- package/dist/BunClusterSocket.js.map +1 -1
- package/dist/BunCrypto.d.ts +10 -0
- package/dist/BunCrypto.d.ts.map +1 -0
- package/dist/BunCrypto.js +22 -0
- package/dist/BunCrypto.js.map +1 -0
- package/dist/BunFileSystem.d.ts +4 -2
- package/dist/BunFileSystem.d.ts.map +1 -1
- package/dist/BunFileSystem.js +11 -3
- package/dist/BunFileSystem.js.map +1 -1
- package/dist/BunHttpClient.d.ts +2 -2
- package/dist/BunHttpClient.js +2 -2
- package/dist/BunHttpPlatform.d.ts +4 -2
- package/dist/BunHttpPlatform.d.ts.map +1 -1
- package/dist/BunHttpPlatform.js +5 -3
- package/dist/BunHttpPlatform.js.map +1 -1
- package/dist/BunHttpServer.d.ts +58 -21
- package/dist/BunHttpServer.d.ts.map +1 -1
- package/dist/BunHttpServer.js +63 -36
- package/dist/BunHttpServer.js.map +1 -1
- package/dist/BunHttpServerRequest.d.ts +11 -3
- package/dist/BunHttpServerRequest.d.ts.map +1 -1
- package/dist/BunHttpServerRequest.js +4 -2
- package/dist/BunHttpServerRequest.js.map +1 -1
- package/dist/BunMultipart.d.ts +16 -5
- package/dist/BunMultipart.d.ts.map +1 -1
- package/dist/BunMultipart.js +15 -5
- package/dist/BunMultipart.js.map +1 -1
- package/dist/BunPath.d.ts +12 -6
- package/dist/BunPath.d.ts.map +1 -1
- package/dist/BunPath.js +20 -7
- package/dist/BunPath.js.map +1 -1
- package/dist/BunRedis.d.ts +23 -9
- package/dist/BunRedis.d.ts.map +1 -1
- package/dist/BunRedis.js +26 -12
- package/dist/BunRedis.js.map +1 -1
- package/dist/BunRuntime.d.ts +21 -30
- package/dist/BunRuntime.d.ts.map +1 -1
- package/dist/BunRuntime.js +14 -11
- package/dist/BunRuntime.js.map +1 -1
- package/dist/BunServices.d.ts +19 -5
- package/dist/BunServices.d.ts.map +1 -1
- package/dist/BunServices.js +7 -3
- package/dist/BunServices.js.map +1 -1
- package/dist/BunSink.d.ts +2 -2
- package/dist/BunSink.js +2 -2
- package/dist/BunSocket.d.ts +18 -4
- package/dist/BunSocket.d.ts.map +1 -1
- package/dist/BunSocket.js +10 -3
- package/dist/BunSocket.js.map +1 -1
- package/dist/BunSocketServer.d.ts +2 -2
- package/dist/BunSocketServer.js +2 -2
- package/dist/BunStdio.d.ts +5 -2
- package/dist/BunStdio.d.ts.map +1 -1
- package/dist/BunStdio.js +13 -3
- package/dist/BunStdio.js.map +1 -1
- package/dist/BunStream.d.ts +5 -4
- package/dist/BunStream.d.ts.map +1 -1
- package/dist/BunStream.js +28 -20
- package/dist/BunStream.js.map +1 -1
- package/dist/BunTerminal.d.ts +8 -2
- package/dist/BunTerminal.d.ts.map +1 -1
- package/dist/BunTerminal.js +15 -3
- package/dist/BunTerminal.js.map +1 -1
- package/dist/BunWorker.d.ts +9 -2
- package/dist/BunWorker.d.ts.map +1 -1
- package/dist/BunWorker.js +20 -4
- package/dist/BunWorker.js.map +1 -1
- package/dist/BunWorkerRunner.d.ts +5 -1
- package/dist/BunWorkerRunner.d.ts.map +1 -1
- package/dist/BunWorkerRunner.js +17 -5
- package/dist/BunWorkerRunner.js.map +1 -1
- package/dist/index.d.ts +25 -23
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -23
- package/dist/index.js.map +1 -1
- package/package.json +7 -8
- package/src/BunChildProcessSpawner.ts +2 -2
- package/src/BunClusterHttp.ts +49 -11
- package/src/BunClusterSocket.ts +27 -9
- package/src/BunCrypto.ts +24 -0
- package/src/BunFileSystem.ts +11 -3
- package/src/BunHttpClient.ts +2 -2
- package/src/BunHttpPlatform.ts +14 -4
- package/src/BunHttpServer.ts +108 -57
- package/src/BunHttpServerRequest.ts +11 -3
- package/src/BunMultipart.ts +24 -6
- package/src/BunPath.ts +20 -7
- package/src/BunRedis.ts +28 -14
- package/src/BunRuntime.ts +28 -31
- package/src/BunServices.ts +21 -5
- package/src/BunSink.ts +2 -2
- package/src/BunSocket.ts +18 -4
- package/src/BunSocketServer.ts +2 -2
- package/src/BunStdio.ts +13 -3
- package/src/BunStream.ts +31 -23
- package/src/BunTerminal.ts +15 -3
- package/src/BunWorker.ts +20 -4
- package/src/BunWorkerRunner.ts +17 -5
- package/src/index.ts +26 -23
package/src/BunWorkerRunner.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
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
|
-
*
|
|
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.
|
|
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
|
-
})
|
|
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
|
-
})
|
|
88
|
+
})
|
|
77
89
|
)
|
|
78
90
|
}
|
|
79
91
|
yield* Scope.addFinalizer(
|
package/src/index.ts
CHANGED
|
@@ -1,112 +1,115 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @since
|
|
2
|
+
* @since 4.0.0
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
// @barrel: Auto-generated exports. Do not edit manually.
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
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
|
|
13
|
+
* @since 4.0.0
|
|
16
14
|
*/
|
|
17
15
|
export * as BunClusterHttp from "./BunClusterHttp.ts"
|
|
18
16
|
|
|
19
17
|
/**
|
|
20
|
-
* @since
|
|
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
|
|
33
|
+
* @since 4.0.0
|
|
31
34
|
*/
|
|
32
35
|
export * as BunHttpClient from "./BunHttpClient.ts"
|
|
33
36
|
|
|
34
37
|
/**
|
|
35
|
-
* @since
|
|
38
|
+
* @since 4.0.0
|
|
36
39
|
*/
|
|
37
40
|
export * as BunHttpPlatform from "./BunHttpPlatform.ts"
|
|
38
41
|
|
|
39
42
|
/**
|
|
40
|
-
* @since
|
|
43
|
+
* @since 4.0.0
|
|
41
44
|
*/
|
|
42
45
|
export * as BunHttpServer from "./BunHttpServer.ts"
|
|
43
46
|
|
|
44
47
|
/**
|
|
45
|
-
* @since
|
|
48
|
+
* @since 4.0.0
|
|
46
49
|
*/
|
|
47
50
|
export * as BunHttpServerRequest from "./BunHttpServerRequest.ts"
|
|
48
51
|
|
|
49
52
|
/**
|
|
50
|
-
* @since
|
|
53
|
+
* @since 4.0.0
|
|
51
54
|
*/
|
|
52
55
|
export * as BunMultipart from "./BunMultipart.ts"
|
|
53
56
|
|
|
54
57
|
/**
|
|
55
|
-
* @since
|
|
58
|
+
* @since 4.0.0
|
|
56
59
|
*/
|
|
57
60
|
export * as BunPath from "./BunPath.ts"
|
|
58
61
|
|
|
59
62
|
/**
|
|
60
|
-
* @since
|
|
63
|
+
* @since 4.0.0
|
|
61
64
|
*/
|
|
62
65
|
export * as BunRedis from "./BunRedis.ts"
|
|
63
66
|
|
|
64
67
|
/**
|
|
65
|
-
* @since
|
|
68
|
+
* @since 4.0.0
|
|
66
69
|
*/
|
|
67
70
|
export * as BunRuntime from "./BunRuntime.ts"
|
|
68
71
|
|
|
69
72
|
/**
|
|
70
|
-
* @since
|
|
73
|
+
* @since 4.0.0
|
|
71
74
|
*/
|
|
72
75
|
export * as BunServices from "./BunServices.ts"
|
|
73
76
|
|
|
74
77
|
/**
|
|
75
|
-
* @since
|
|
78
|
+
* @since 4.0.0
|
|
76
79
|
*/
|
|
77
80
|
export * as BunSink from "./BunSink.ts"
|
|
78
81
|
|
|
79
82
|
/**
|
|
80
|
-
* @since
|
|
83
|
+
* @since 4.0.0
|
|
81
84
|
*/
|
|
82
85
|
export * as BunSocket from "./BunSocket.ts"
|
|
83
86
|
|
|
84
87
|
/**
|
|
85
|
-
* @since
|
|
88
|
+
* @since 4.0.0
|
|
86
89
|
*/
|
|
87
90
|
export * as BunSocketServer from "./BunSocketServer.ts"
|
|
88
91
|
|
|
89
92
|
/**
|
|
90
|
-
* @since
|
|
93
|
+
* @since 4.0.0
|
|
91
94
|
*/
|
|
92
95
|
export * as BunStdio from "./BunStdio.ts"
|
|
93
96
|
|
|
94
97
|
/**
|
|
95
|
-
* @since
|
|
98
|
+
* @since 4.0.0
|
|
96
99
|
*/
|
|
97
100
|
export * as BunStream from "./BunStream.ts"
|
|
98
101
|
|
|
99
102
|
/**
|
|
100
|
-
* @since
|
|
103
|
+
* @since 4.0.0
|
|
101
104
|
*/
|
|
102
105
|
export * as BunTerminal from "./BunTerminal.ts"
|
|
103
106
|
|
|
104
107
|
/**
|
|
105
|
-
* @since
|
|
108
|
+
* @since 4.0.0
|
|
106
109
|
*/
|
|
107
110
|
export * as BunWorker from "./BunWorker.ts"
|
|
108
111
|
|
|
109
112
|
/**
|
|
110
|
-
* @since
|
|
113
|
+
* @since 4.0.0
|
|
111
114
|
*/
|
|
112
115
|
export * as BunWorkerRunner from "./BunWorkerRunner.ts"
|