Repository navigation
Expand file tree
/
Copy pathCargo.toml
More file actions
230 lines (191 loc) · 7.43 KB
/
Copy pathCargo.toml
File metadata and controls
230 lines (191 loc) · 7.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
[package]
name = "openworkers-runner"
version = "1.18.6"
edition = "2024"
license = "MIT"
default-run = "openworkers-runner"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
default = ["database"]
# Runtime backends, exactly one per build
v8 = ["dep:openworkers-runtime-v8", "_js"]
jsc = ["dep:openworkers-runtime-jsc", "_js"]
quickjs = ["dep:openworkers-runtime-quickjs", "_js"]
boa = ["dep:openworkers-runtime-boa", "_js"]
nova = ["dep:openworkers-runtime-nova", "_js"]
wasm = ["dep:openworkers-runtime-wasm", "openworkers-core/wasm"]
# Internal: the guest is JavaScript, so its sources need transpiling and lowering
_js = ["dep:openworkers-transform"]
database = ["dep:postgate"]
telemetry = [
"dep:opentelemetry",
"dep:opentelemetry-otlp",
"dep:opentelemetry_sdk",
"dep:tracing-opentelemetry",
"dep:opentelemetry-appender-tracing",
"dep:tonic",
]
[dependencies]
# HTTP server (hyper)
hyper = { version = "1", features = ["server", "http1", "http2"] }
hyper-util = { version = "0.1", features = ["tokio", "server-auto"] }
http-body-util = "0.1"
bytes = "1.11.0"
ipnet = "2"
log = "0.4.29"
tokio = { version = "1.49.0", features = ["macros", "rt-multi-thread", "signal"] }
tokio-util = { version = "0.7", features = ["rt"] }
once_cell = "1.19"
env_logger = "0.11.6"
lru = "0.18.4"
# Tracing (always available)
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
# OpenTelemetry (optional, via telemetry feature)
opentelemetry = { version = "0.33", optional = true }
opentelemetry-otlp = { version = "0.33", features = ["grpc-tonic", "tls-roots", "tls-provider-agnostic"], optional = true }
tonic = { version = "0.14", optional = true }
opentelemetry_sdk = { version = "0.33", features = ["rt-tokio"], optional = true }
tracing-opentelemetry = { version = "0.34", optional = true }
opentelemetry-appender-tracing = { version = "0.33", optional = true }
sqlx = { version = "0.9.0", features = [ "runtime-tokio", "postgres", "uuid", "chrono", "bigdecimal", "rust_decimal", "tls-rustls" ] }
reqwest = { version = "0.13.1", default-features = false, features = ["rustls", "json", "stream"] }
# Both ring and aws-lc-rs reach rustls through the dependencies, so rustls
# cannot pick a process-wide provider by itself; main installs this one.
rustls = { version = "0.23", default-features = false, features = ["aws_lc_rs"] }
tokio-tungstenite = { version = "0.30", default-features = false, features = ["handshake"] }
# Core types
# Every backend has to name this same tag: two cores in one build are two
# unrelated sets of types, and cargo will not [patch] a tagged git dependency
openworkers-core = { git = "https://github.com/openworkers/openworkers-core", tag = "v0.18.0", features = ["hyper"] }
# Transform (TS strip + export default -> globalThis.default)
openworkers-transform = { git = "https://github.com/openworkers/openworkers-transform", tag = "v0.1.3", optional = true }
# Runtime backends
openworkers-runtime-v8 = { git = "https://github.com/openworkers/openworkers-runtime-v8", tag = "v0.18.4", optional = true, features = ["ptrcomp"] }
openworkers-runtime-jsc = { git = "https://github.com/openworkers/openworkers-runtime-jsc", tag = "v0.18.0", optional = true }
openworkers-runtime-quickjs = { git = "https://github.com/openworkers/openworkers-runtime-quickjs", tag = "v0.18.0", optional = true }
openworkers-runtime-boa = { git = "https://github.com/openworkers/openworkers-runtime-boa", tag = "v0.18.0", optional = true }
openworkers-runtime-nova = { git = "https://github.com/openworkers/openworkers-runtime-nova", tag = "v0.18.0", optional = true }
openworkers-runtime-wasm = { git = "https://github.com/openworkers/openworkers-runtime-wasm", tag = "v0.18.0", optional = true }
# Database bindings (optional)
# postgate = { path = "../postgate", default-features = false, optional = true }
postgate = { git = "https://github.com/openworkers/postgate", tag = "v0.1.8", default-features = false, optional = true }
futures = "0.3"
# D1 databases: SQLite built from source, so every host runs the same version
rusqlite = { version = "0.39", features = ["bundled", "hooks", "limits"] }
zstd = "0.13"
libc = "0.2"
serde_json = "1.0"
serde = { version = "1.0.197", features = ["derive"] }
base64 = "0.23"
aws-sigv4 = "1.2"
aws-credential-types = "1.2"
chrono = { version = "0.4.43", features = ["serde"] }
croner = "4.0.0"
tokio-rustls = "0.26"
sha2 = "0.11"
hmac = "0.13"
hex = "0.4"
uuid = { version = "1.20", features = ["v4"] }
url = "2.5"
dotenvy = "0.15.7"
percent-encoding = "2.3.2"
# https://doc.rust-lang.org/cargo/reference/profiles.html
# https://github.com/johnthagen/min-sized-rust?tab=readme-ov-file#minimizing-rust-binary-size
[profile.release]
strip = true # Automatically strip symbols from the binary.
opt-level = "z" # Optimize for size.
incremental = true # Enable incremental compilation.
codegen-units = 1 # Use a single codegen unit to optimize for size.
lto = true # Enable link-time optimization.
# Optimizing for size costs an interpreter dearly: nova is Rust all the way down,
# so its evaluation loop is in this build, where v8's is inside a library someone
# else compiled. Same for the SWC pass that lowers a module to a classic script.
[profile.release.package.nova_vm]
opt-level = 3
[profile.release.package.openworkers-transform]
opt-level = 3
[profile.release.package.swc_ecma_parser]
opt-level = 3
[profile.release.package.swc_ecma_transforms_base]
opt-level = 3
[dev-dependencies]
criterion = { version = "0.8.1", features = ["async_tokio"] }
wat = "1.0"
serial_test = "4.0"
tempfile = "3"
# Reads what the metrics record, in memory
opentelemetry_sdk = { version = "0.33", features = ["testing"] }
# Not every backend pulls the full tokio, but every test harness needs these
tokio = { version = "1.49.0", features = ["macros", "rt", "time", "test-util"] }
[[bin]]
name = "openworkers-runner"
path = "bin/main.rs"
[[bin]]
name = "snapshot"
path = "bin/snapshot.rs"
required-features = ["v8"]
[[bench]]
name = "worker_benchmark"
harness = false
required-features = ["v8"]
# Runs against whichever JavaScript backend is selected
[[test]]
name = "backend_test"
[[test]]
name = "wasm_tests"
required-features = ["wasm"]
# Builds tests/fixtures/bindings-worker, so it needs the wasm32-wasip2 target
[[test]]
name = "wasm_bindings_test"
required-features = ["wasm"]
# Both backends in one binary, so it needs both features
[[test]]
name = "cohabitation_test"
required-features = ["v8", "wasm"]
# The rest drive openworkers-runtime-v8 directly
[[test]]
name = "abort_scope_test"
required-features = ["v8"]
[[test]]
name = "fetch_streaming_test"
required-features = ["v8"]
[[test]]
name = "hyper_integration_test"
required-features = ["v8"]
[[test]]
name = "inbound_websocket_test"
required-features = ["v8"]
[[test]]
name = "pinned_pool_test"
required-features = ["v8"]
[[test]]
name = "slot_timeout_test"
required-features = ["v8"]
[[test]]
name = "heap_metric_test"
required-features = ["telemetry"]
[[test]]
name = "request_body_streaming_test"
required-features = ["v8"]
[[test]]
name = "sse_streaming_test"
required-features = ["v8"]
[[test]]
name = "stream_cancellation_test"
required-features = ["v8"]
[[test]]
name = "warm_reuse_test"
required-features = ["v8"]
[[test]]
name = "web_api_test"
required-features = ["v8"]
[[test]]
name = "websocket_test"
required-features = ["v8"]
[[test]]
name = "worker_handlers_test"
required-features = ["v8"]
[[test]]
name = "worker_tests"
required-features = ["v8"]