castrum 0.9.3 → 0.9.6

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 (206) hide show
  1. package/Cargo.lock +2242 -0
  2. package/Cargo.toml +155 -0
  3. package/README.md +14 -6
  4. package/build.rs +5 -0
  5. package/castrum.darwin-arm64.node +0 -0
  6. package/castrum.darwin-x64.node +0 -0
  7. package/castrum.linux-arm64-gnu.node +0 -0
  8. package/castrum.linux-arm64-musl.node +0 -0
  9. package/castrum.linux-x64-gnu.node +0 -0
  10. package/castrum.linux-x64-musl.node +0 -0
  11. package/castrum.linux-x64-v3-gnu.node +0 -0
  12. package/castrum.win32-x64-msvc.node +0 -0
  13. package/dist/index.d.ts +1508 -1291
  14. package/dist/index.js +3391 -2069
  15. package/docs/API.md +2 -1
  16. package/docs/ARCHITECTURE.md +3 -2
  17. package/docs/CASE_STUDY.md +5 -3
  18. package/docs/ENVIRONMENT.md +25 -2
  19. package/docs/FFI_BUN_GUIDE.md +242 -14
  20. package/docs/HOW_TO_ADD_AN_OP.md +10 -0
  21. package/docs/REPO_MAP.md +17 -6
  22. package/docs/RND-CONCURRENCY.md +772 -0
  23. package/docs/bun-builtins-decision-matrix.md +4 -1
  24. package/index.ts +24 -25
  25. package/package.json +173 -156
  26. package/rust/crypto/aead.rs +378 -0
  27. package/rust/crypto/argon2.rs +265 -0
  28. package/rust/crypto/base64.rs +420 -0
  29. package/rust/crypto/bcrypt.rs +89 -0
  30. package/rust/crypto/cookie_sign.rs +169 -0
  31. package/rust/crypto/csrf.rs +106 -0
  32. package/rust/crypto/ed25519.rs +215 -0
  33. package/rust/crypto/hashing.rs +140 -0
  34. package/rust/crypto/hmac_sha256.rs +88 -0
  35. package/rust/crypto/jwt/api.rs +286 -0
  36. package/rust/crypto/jwt/mod.rs +22 -0
  37. package/rust/crypto/jwt/tests.rs +312 -0
  38. package/rust/crypto/jwt/token.rs +360 -0
  39. package/rust/crypto/mod.rs +27 -0
  40. package/rust/crypto/pbkdf2.rs +105 -0
  41. package/rust/crypto/random_token.rs +85 -0
  42. package/rust/crypto/session.rs +222 -0
  43. package/rust/ffi/crypto.rs +708 -0
  44. package/rust/ffi/hashing.rs +285 -0
  45. package/rust/ffi/http.rs +752 -0
  46. package/rust/ffi/ingress.rs +303 -0
  47. package/rust/ffi/json.rs +517 -0
  48. package/rust/ffi/jwt.rs +419 -0
  49. package/rust/ffi/metrics.rs +373 -0
  50. package/rust/ffi/mod.rs +69 -0
  51. package/rust/ffi/payload.rs +275 -0
  52. package/rust/ffi/probe.rs +60 -0
  53. package/rust/ffi/rate_limit.rs +77 -0
  54. package/rust/ffi/route.rs +85 -0
  55. package/rust/ffi/task.rs +172 -0
  56. package/rust/ffi/tests.rs +2333 -0
  57. package/rust/ffi/util.rs +152 -0
  58. package/rust/ffi/validators.rs +123 -0
  59. package/rust/http/accept.rs +606 -0
  60. package/rust/http/cookie_parser.rs +140 -0
  61. package/rust/http/etag.rs +289 -0
  62. package/rust/http/form.rs +136 -0
  63. package/rust/http/headers.rs +267 -0
  64. package/rust/http/http_date.rs +286 -0
  65. package/rust/http/http_parser.rs +252 -0
  66. package/rust/http/media_type.rs +355 -0
  67. package/rust/http/method.rs +200 -0
  68. package/rust/http/mime_lookup.rs +130 -0
  69. package/rust/http/mod.rs +32 -0
  70. package/rust/http/multipart.rs +685 -0
  71. package/rust/http/query_parser.rs +211 -0
  72. package/rust/http/url_codec.rs +296 -0
  73. package/rust/http/url_join.rs +324 -0
  74. package/rust/ingress/api.rs +355 -0
  75. package/rust/ingress/cors.rs +403 -0
  76. package/rust/ingress/ingress_constants.rs +209 -0
  77. package/rust/ingress/ip_trust.rs +312 -0
  78. package/rust/ingress/mod.rs +48 -0
  79. package/rust/ingress/native_route.rs +770 -0
  80. package/rust/ingress/options.rs +176 -0
  81. package/rust/ingress/output.rs +406 -0
  82. package/rust/ingress/packed.rs +191 -0
  83. package/rust/ingress/pipeline.rs +534 -0
  84. package/rust/ingress/proxy.rs +138 -0
  85. package/rust/ingress/rate_limit.rs +538 -0
  86. package/rust/ingress/terminal.rs +114 -0
  87. package/rust/ingress/tests.rs +567 -0
  88. package/rust/ingress/time.rs +70 -0
  89. package/rust/json/fast_schema/capture.rs +336 -0
  90. package/rust/json/fast_schema/compile.rs +556 -0
  91. package/rust/json/fast_schema/cursor.rs +368 -0
  92. package/rust/json/fast_schema/email.rs +282 -0
  93. package/rust/json/fast_schema/errors.rs +247 -0
  94. package/rust/json/fast_schema/mod.rs +57 -0
  95. package/rust/json/fast_schema/tests.rs +1143 -0
  96. package/rust/json/fast_schema/types.rs +140 -0
  97. package/rust/json/fast_schema/validate.rs +931 -0
  98. package/rust/json/json_ops.rs +121 -0
  99. package/rust/json/json_schema.rs +837 -0
  100. package/rust/json/json_ser.rs +883 -0
  101. package/rust/json/mod.rs +19 -0
  102. package/rust/json/napi_marshal.rs +318 -0
  103. package/rust/json/patch/api.rs +60 -0
  104. package/rust/json/patch/engine.rs +153 -0
  105. package/rust/json/patch/mod.rs +47 -0
  106. package/rust/json/patch/ops.rs +270 -0
  107. package/rust/json/patch/pointer.rs +49 -0
  108. package/rust/json/patch/tests.rs +499 -0
  109. package/rust/lib.rs +73 -0
  110. package/rust/metrics/api.rs +148 -0
  111. package/rust/metrics/mod.rs +21 -0
  112. package/rust/metrics/registry.rs +961 -0
  113. package/rust/panic_safety.rs +40 -0
  114. package/rust/payload/compress.rs +512 -0
  115. package/rust/payload/mod.rs +13 -0
  116. package/rust/payload/sse.rs +214 -0
  117. package/rust/payload/template.rs +253 -0
  118. package/rust/payload/websocket.rs +69 -0
  119. package/rust/payload/ws_frames.rs +354 -0
  120. package/rust/proptest_suite.rs +139 -0
  121. package/rust/selection.rs +95 -0
  122. package/rust/src/bin/native-bench.rs +495 -0
  123. package/rust/task/completion.rs +119 -0
  124. package/rust/task/mod.rs +65 -0
  125. package/rust/task/ops.rs +503 -0
  126. package/rust/task/runtime.rs +220 -0
  127. package/rust/task/tests.rs +231 -0
  128. package/rust/test_support.rs +71 -0
  129. package/rust/util/batch/api.rs +266 -0
  130. package/rust/util/batch/core.rs +473 -0
  131. package/rust/util/batch/mod.rs +23 -0
  132. package/rust/util/batch/tests.rs +445 -0
  133. package/rust/util/batch_core.rs +184 -0
  134. package/rust/util/bytes.rs +594 -0
  135. package/rust/util/mod.rs +34 -0
  136. package/rust/util/packed.rs +473 -0
  137. package/rust/util/text.rs +130 -0
  138. package/rust/util/threadpool.rs +128 -0
  139. package/rust/util/validation.rs +419 -0
  140. package/rust-toolchain.toml +17 -0
  141. package/scripts/postinstall.mjs +199 -0
  142. package/src/ingress/constants.ts +1 -1
  143. package/src/ingress/context.ts +2 -2
  144. package/src/ingress/decode/baked-result.ts +13 -13
  145. package/src/ingress/decode/fast-result.ts +17 -17
  146. package/src/ingress/errors.ts +7 -7
  147. package/src/ingress/headers/baked-templates.ts +1 -1
  148. package/src/ingress/headers/fast-templates.ts +3 -3
  149. package/src/ingress/health.ts +1 -2
  150. package/src/ingress/index.ts +1 -1
  151. package/src/ingress/native-route.ts +9 -5
  152. package/src/ingress/options.ts +1 -1
  153. package/src/ingress/packing/gather-raw-headers.ts +1 -1
  154. package/src/ingress/packing/route-wire.ts +1 -5
  155. package/src/ingress/response/error-bodies.ts +5 -5
  156. package/src/ingress/response/terminal.ts +1 -1
  157. package/src/ingress/routes/echo.ts +4 -4
  158. package/src/ingress/routes/fallback.ts +2 -2
  159. package/src/ingress/routes/head.ts +2 -2
  160. package/src/ingress/routes/native.ts +2 -1
  161. package/src/ingress/routes/options.ts +1 -1
  162. package/src/ingress/routes/read.ts +2 -2
  163. package/src/ingress/server.ts +10 -6
  164. package/src/ingress/status.ts +7 -7
  165. package/src/integration/batch.ts +1 -1
  166. package/src/integration/index.ts +9 -9
  167. package/src/integration/pipeline.ts +6 -6
  168. package/src/integration/websocket.ts +2 -2
  169. package/src/loader/index.ts +1 -5
  170. package/src/loader/ops.ts +1 -1
  171. package/src/native/ffi/build/codecs.ts +130 -12
  172. package/src/native/ffi/build/compress.ts +22 -10
  173. package/src/native/ffi/build/instances.ts +46 -4
  174. package/src/native/ffi/build/metrics.ts +247 -0
  175. package/src/native/ffi/build/parse.ts +59 -23
  176. package/src/native/ffi/build/task.ts +79 -0
  177. package/src/native/ffi/build/util.ts +32 -1
  178. package/src/native/ffi/build.ts +4 -0
  179. package/src/native/ffi/selftest.ts +12 -3
  180. package/src/native/ffi/types.ts +151 -9
  181. package/src/native/ffi.ts +160 -15
  182. package/src/native/index.ts +1 -1
  183. package/src/native/loader.ts +55 -5
  184. package/src/native/types/instances.ts +34 -0
  185. package/src/native/types.ts +11 -0
  186. package/src/runtime/codec.ts +53 -9
  187. package/src/runtime/types.ts +7 -0
  188. package/src/rust-ffi/batch/build.ts +16 -9
  189. package/src/rust-ffi/index.ts +7 -6
  190. package/src/rust-ffi/options.ts +1 -3
  191. package/src/rust-ffi/proven.ts +3 -3
  192. package/src/rust-ffi/scalar/crypto.ts +1 -1
  193. package/src/rust-ffi/scalar/factories.ts +73 -0
  194. package/src/rust-ffi/scalar/hashing.ts +1 -1
  195. package/src/rust-ffi/scalar/http.ts +71 -27
  196. package/src/rust-ffi/scalar/index.ts +2 -0
  197. package/src/rust-ffi/scalar/interface.ts +20 -0
  198. package/src/rust-ffi/scalar/payload.ts +11 -3
  199. package/src/rust-ffi/scalar/validation.ts +121 -0
  200. package/src/rust-ffi/text.ts +25 -3
  201. package/src/selection.ts +1 -1
  202. package/src/shared/bytes.ts +24 -4
  203. package/src/shared/codec.ts +18 -3
  204. package/src/task/index.ts +24 -0
  205. package/src/task/op.ts +171 -0
  206. package/src/task/runtime.ts +568 -0
@@ -7,7 +7,10 @@
7
7
 
8
8
  ## Methodology
9
9
 
10
- - **Runtime**: Bun **1.4.0** (the primary target).
10
+ - **Runtime**: Bun **1.4.0** (the measurement anchor for the rows below; the
11
+ local toolchain has since moved to **1.4.2**, and these TIMING rows have not
12
+ been re-measured — only re-verified for parity, which
13
+ `test/unit/contract/delegation.test.ts` does on every run).
11
14
  - **Addon**: castrum **release** build (`bun run build`, baseline CPU — the
12
15
  shipped profile).
13
16
  - **Driver**: `bun run check` (CPU benchmark → `bench/results/cpu/latest.json`).
package/index.ts CHANGED
@@ -11,50 +11,49 @@
11
11
  // load. Do NOT add more eager-native modules; keep everything else lazy (see
12
12
  // test/unit/features/import-contract.test.ts).
13
13
 
14
+ export * from './src/ingress'
15
+ // Framework-agnostic integration helpers: run the ingress pipeline as a
16
+ // request stage (createPipeline), RFC 6455 upgrade (createWebSocketUpgrade),
17
+ // and SSE framing (sseResponse). See docs/INGRESS.md.
18
+ export * from './src/integration'
19
+ // Higher-order loader (HFC) over the curated op set: createLoader / loader
20
+ // dispatch single items, packed batches, and load() coalescing. See README.
21
+ export * from './src/loader'
14
22
  export * from './src/rust-ffi'
15
-
23
+ // Off-thread native task runtime ("castrum Tasks"): submit a CPU-bound native
24
+ // op to the Rust pool and `await` it without ever blocking the JS thread.
25
+ // Bun-only offload today; Node runs the op synchronously. See
26
+ // docs/RND-CONCURRENCY.md.
27
+ export * from './src/task'
28
+ export type { OpDecision, OpImpl } from './src/selection'
16
29
  // Native-vs-JS selection (OWNED HERE, not by consumers): `opImpl(op)` is the
17
30
  // benchmark-driven recommendation for which operations should use the Rust
18
31
  // addon vs a pure-JS implementation. Consumers read it once at load time and
19
32
  // bind each op to a fixed impl. Source: rust/selection.rs (audited by
20
33
  // `bun run check:selection`). See src/selection.ts.
21
- export { opImpl, isNativeOp, opDecision } from './src/selection'
22
- export type { OpImpl, OpDecision } from './src/selection'
23
-
24
- export { encoder, decoder } from './src/shared/bytes'
34
+ export { isNativeOp, opDecision, opImpl } from './src/selection'
35
+ export type { AdaptiveEstimateOptions } from './src/shared/adaptive'
25
36
  // Bounded EWMA adaptive-estimate utility (drives BufferPool adaptive sizing
26
37
  // and reusable runtime self-optimization decisions).
27
38
  export { AdaptiveEstimate } from './src/shared/adaptive'
28
- export type { AdaptiveEstimateOptions } from './src/shared/adaptive'
29
- // UUIDv7 generation — delegates to Bun.randomUUIDv7, crypto.randomUUID on Node.
30
- export { uuidv7 } from './src/shared/uuid'
39
+ export { decoder, encoder } from './src/shared/bytes'
40
+ export type { Counter, Gauge, Histogram, MetricsRegistry } from './src/shared/metrics'
31
41
  // Zero-dep metrics registry (counters/gauges/histograms + Prometheus render).
32
42
  export { createMetrics, DEFAULT_BUCKETS } from './src/shared/metrics'
33
- export type { MetricsRegistry, Counter, Gauge, Histogram } from './src/shared/metrics'
34
-
43
+ export type { Pair, ParsedHttpRequestPacked } from './src/shared/packed'
35
44
  export {
36
45
  packBatch,
37
46
  packPairs,
38
- readPairsPacked,
39
- readHttpPacked,
40
47
  pairsToObject,
41
- parseQueryString,
42
48
  parseCookieHeader,
43
49
  parseFormBody,
50
+ parseQueryString,
51
+ readHttpPacked,
52
+ readPairsPacked,
44
53
  unpackBitset,
45
54
  unpackByteResults,
46
55
  unpackI64ArrayAsBigInt,
47
56
  unpackU32Array,
48
57
  } from './src/shared/packed'
49
- export type { Pair, ParsedHttpRequestPacked } from './src/shared/packed'
50
-
51
- export * from './src/ingress'
52
-
53
- // Framework-agnostic integration helpers: run the ingress pipeline as a
54
- // request stage (createPipeline), RFC 6455 upgrade (createWebSocketUpgrade),
55
- // and SSE framing (sseResponse). See docs/INGRESS.md.
56
- export * from './src/integration'
57
-
58
- // Higher-order loader (HFC) over the curated op set: createLoader / loader
59
- // dispatch single items, packed batches, and load() coalescing. See README.
60
- export * from './src/loader'
58
+ // UUIDv7 generation — delegates to Bun.randomUUIDv7, crypto.randomUUID on Node.
59
+ export { uuidv7 } from './src/shared/uuid'
package/package.json CHANGED
@@ -1,160 +1,177 @@
1
1
  {
2
- "name": "castrum",
3
- "version": "0.9.3",
4
- "private": false,
5
- "description": "Enterprise-grade Bun + Rust runtime: Rust-accelerated FFI primitives, a production-grade HTTP ingress pipeline, validation, hashing, and JSON processing with benchmark-grade performance.",
6
- "type": "module",
7
- "main": "dist/index.js",
8
- "module": "dist/index.js",
9
- "types": "dist/index.d.ts",
10
- "license": "MIT",
11
- "keywords": [
12
- "bun",
13
- "rust",
14
- "napi",
15
- "ffi",
16
- "ingress",
17
- "http",
18
- "validation",
19
- "hashing",
20
- "json",
21
- "performance",
22
- "benchmark"
23
- ],
24
- "repository": {
25
- "type": "git",
26
- "url": "git+https://github.com/Axylabs/flux-rs.git"
2
+ "name": "castrum",
3
+ "version": "0.9.6",
4
+ "private": false,
5
+ "description": "Enterprise-grade Bun + Rust runtime: Rust-accelerated FFI primitives, a production-grade HTTP ingress pipeline, validation, hashing, and JSON processing with benchmark-grade performance.",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "module": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "license": "MIT",
11
+ "keywords": [
12
+ "bun",
13
+ "rust",
14
+ "napi",
15
+ "ffi",
16
+ "ingress",
17
+ "http",
18
+ "validation",
19
+ "hashing",
20
+ "json",
21
+ "performance",
22
+ "benchmark"
23
+ ],
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/Axylabs/castrum.git"
27
+ },
28
+ "homepage": "https://github.com/Axylabs/castrum#readme",
29
+ "bugs": {
30
+ "url": "https://github.com/Axylabs/castrum/issues"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "exports": {
36
+ ".": {
37
+ "types": "./dist/index.d.ts",
38
+ "bun": "./index.ts",
39
+ "node": "./dist/index.js",
40
+ "default": "./dist/index.js"
27
41
  },
28
- "homepage": "https://github.com/Axylabs/flux-rs#readme",
29
- "bugs": {
30
- "url": "https://github.com/Axylabs/flux-rs/issues"
31
- },
32
- "publishConfig": {
33
- "access": "public"
34
- },
35
- "exports": {
36
- ".": {
37
- "types": "./dist/index.d.ts",
38
- "bun": "./index.ts",
39
- "node": "./dist/index.js",
40
- "default": "./dist/index.js"
41
- },
42
- "./package.json": "./package.json"
43
- },
44
- "files": [
45
- "index.ts",
46
- "dist",
47
- "src",
48
- "docs",
49
- "README.md",
50
- "*.node",
51
- "!src/bench",
52
- "!src/baseline",
53
- "!src/data"
54
- ],
55
- "scripts": {
56
- "build": "napi build --release --platform",
57
- "build:perf": "bash scripts/build-perf.sh",
58
- "build:v3": "bash scripts/build-v3.sh",
59
- "build:all": "bun run build && bun run build:v3",
60
- "build:js": "bun run build:js:bundle && bun run build:js:types",
61
- "build:js:bundle": "bun build ./index.ts --target=node --format=esm --outdir=dist",
62
- "build:js:types": "dts-bundle-generator -o dist/index.d.ts index.ts",
63
- "bench": "bun run build && bun bench.ts",
64
- "check": "bun bench.ts",
65
- "test": "bun test",
66
- "test:all": "bun test && bun run typecheck && bun run typecheck:test && bun run lint:ci && bun run check:clean && cargo test --lib",
67
- "test:coverage": "node scripts/check-coverage.mjs",
68
- "setup": "bun install && bun run build",
69
- "test:node": "node --test test/integration/node-smoke.test.mjs test/integration/node-enterprise.test.mjs",
70
- "verify:install": "node scripts/verify-install.mjs",
71
- "build:debug": "napi build --platform",
72
- "lint": "bunx biome check .",
73
- "lint:fix": "bunx biome check --write .",
74
- "lint:ci": "bunx biome check . --formatter-enabled=false --assist-enabled=false --error-on-warnings",
75
- "format": "bunx biome format --write .",
76
- "typecheck": "bunx tsc --noEmit",
77
- "typecheck:test": "bunx tsc --noEmit -p tsconfig.test.json",
78
- "test:rust": "cargo test",
79
- "deny": "cargo deny check",
80
- "check:version": "bun scripts/check-version.mjs",
81
- "check:jsdoc": "bun scripts/check-jsdoc.ts",
82
- "check:selection": "bun scripts/select-native.ts --check",
83
- "check:clean": "bun scripts/check-clean.ts",
84
- "gen:ai-map": "bun scripts/gen-ai-map.ts",
85
- "audit": "bun audit",
86
- "publish:manual": "node scripts/publish-manual.mjs",
87
- "publish:manual:dry": "node scripts/publish-manual.mjs --dry-run",
88
- "prepublishOnly": "bun run build:js && node scripts/prepublish.mjs",
89
- "bench:http": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts",
90
- "bench:http:smoke": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts smoke",
91
- "bench:http:stress": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts stress",
92
- "bench:http:heavy": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts heavy-json",
93
- "bench:http:crud": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts crud",
94
- "bench:http:spike": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts spike",
95
- "bench:http:soak": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts soak",
96
- "bench:http:storm": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts storm",
97
- "bench:http:boundary": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts boundary",
98
- "bench:http:elysia": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts '' elysia",
99
- "bench:http:ingress": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts '' ingress",
100
- "bench:http:bun-only": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts '' bun",
101
- "bench:http:all-heavy": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts 1",
102
- "bench:http:ac": "bun bench/autocannon-stress.mjs",
103
- "bench:http:stress:ac": "SCENARIO=03-stress bun bench/autocannon-stress.mjs",
104
- "bench:startup": "bun run bench/startup.ts",
105
- "bench:load": "bun run bench/http/load-phase.ts",
106
- "bench:ffi": "bun run bench/ffi/ffi-all.ts",
107
- "bench:ffi:load": "bun run bench/ffi/ffi-load.ts",
108
- "bench:ffi:public": "bun run bench/ffi/ffi-public.ts",
109
- "bench:ffi:workers": "bun run bench/ffi/ffi-workers.ts",
110
- "bench:margin": "bun run bench/ffi/ffi-margin.ts",
111
- "bench:router": "bun run bench/cost/router-cost.ts",
112
- "bench:ingress-cost": "bun run bench/cost/ingress-cost.ts",
113
- "bench:ingress-cost:post": "bun run bench/cost/ingress-cost-post.ts",
114
- "verify:native:batch": "bun run scripts/verify-native-batch.ts"
115
- },
116
- "dependencies": {},
117
- "peerDependencies": {
118
- "@types/node": "^26.1.2"
119
- },
120
- "peerDependenciesMeta": {
121
- "@types/node": {
122
- "optional": true
123
- }
124
- },
125
- "devDependencies": {
126
- "@elysia/cors": "^1.4.2",
127
- "@napi-rs/cli": "^3.8.6",
128
- "@types/bun": "^1.3.14",
129
- "@types/mime-types": "^3.0.1",
130
- "autocannon": "^8.0.0",
131
- "@types/validator": "^13.15.10",
132
- "ajv": "^8.20.0",
133
- "crc-32": "^1.2.2",
134
- "dts-bundle-generator": "^9.5.1",
135
- "elysia": "^1.4.29",
136
- "fast-json-patch": "^3.1.1",
137
- "mime-types": "^3.0.2",
138
- "typescript": "5.9.3",
139
- "validator": "^13.15.35"
140
- },
141
- "overrides": {
142
- "typescript": "5.9.3"
42
+ "./package.json": "./package.json"
43
+ },
44
+ "files": [
45
+ "index.ts",
46
+ "dist",
47
+ "src",
48
+ "docs",
49
+ "README.md",
50
+ "*.node",
51
+ "scripts/postinstall.mjs",
52
+ "rust",
53
+ "Cargo.toml",
54
+ "Cargo.lock",
55
+ "build.rs",
56
+ "rust-toolchain.toml",
57
+ "!src/bench",
58
+ "!src/baseline",
59
+ "!src/data"
60
+ ],
61
+ "scripts": {
62
+ "postinstall": "node scripts/postinstall.mjs",
63
+ "build": "napi build --release --platform",
64
+ "build:perf": "bash scripts/build-perf.sh",
65
+ "build:v3": "bash scripts/build-v3.sh",
66
+ "build:all": "bun run build && bun run build:v3",
67
+ "build:js": "bun run build:js:bundle && bun run build:js:types",
68
+ "build:js:bundle": "bun build ./index.ts --target=node --format=esm --outdir=dist",
69
+ "build:js:types": "dts-bundle-generator -o dist/index.d.ts index.ts",
70
+ "bench": "bun run build && bun bench.ts",
71
+ "check": "bun bench.ts",
72
+ "test": "bun test test/unit test/property test/compat",
73
+ "test:all": "bun test && bun run typecheck && bun run typecheck:test && bun run lint:ci && bun run check:clean && cargo test --lib",
74
+ "test:coverage": "node scripts/check-coverage.mjs",
75
+ "setup": "bun install && bun run build",
76
+ "test:node": "node --test test/integration/node-smoke.test.mjs test/integration/node-enterprise.test.mjs",
77
+ "verify:install": "node scripts/verify-install.mjs",
78
+ "build:debug": "napi build --platform",
79
+ "lint": "bunx biome check .",
80
+ "lint:fix": "bunx biome check --write .",
81
+ "lint:ci": "bunx biome check . --formatter-enabled=false --assist-enabled=false --error-on-warnings",
82
+ "format": "bunx biome format --write .",
83
+ "typecheck": "bunx tsc --noEmit",
84
+ "typecheck:test": "bunx tsc --noEmit -p tsconfig.test.json",
85
+ "test:rust": "cargo test",
86
+ "deny": "cargo deny check",
87
+ "check:version": "bun scripts/check-version.mjs",
88
+ "check:jsdoc": "bun scripts/check-jsdoc.ts",
89
+ "check:selection": "bun scripts/select-native.ts --check",
90
+ "check:clean": "bun scripts/check-clean.ts",
91
+ "gen:ai-map": "bun scripts/gen-ai-map.ts",
92
+ "audit": "bun audit",
93
+ "release": "bun scripts/release.ts",
94
+ "release:dry": "bun scripts/release.ts --dry-run",
95
+ "release:manual": "bun scripts/release.ts --publish",
96
+ "prepublishOnly": "bun run build:js && node scripts/prepublish.mjs",
97
+ "bench:http": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts",
98
+ "bench:http:smoke": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts smoke",
99
+ "bench:http:stress": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts stress",
100
+ "bench:http:heavy": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts heavy-json",
101
+ "bench:http:crud": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts crud",
102
+ "bench:http:spike": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts spike",
103
+ "bench:http:soak": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts soak",
104
+ "bench:http:storm": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts storm",
105
+ "bench:http:boundary": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts boundary",
106
+ "bench:http:elysia": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts '' elysia",
107
+ "bench:http:ingress": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts '' ingress",
108
+ "bench:http:bun-only": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts '' bun",
109
+ "bench:http:all-heavy": "BUN_CONFIG_MAX_HTTP_REQUESTS=65535 bun run bench/http/run-bench.ts 1",
110
+ "bench:http:ac": "bun bench/autocannon-stress.mjs",
111
+ "bench:http:stress:ac": "SCENARIO=03-stress bun bench/autocannon-stress.mjs",
112
+ "bench:startup": "bun run bench/startup.ts",
113
+ "bench:load": "bun run bench/http/load-phase.ts",
114
+ "bench:ffi": "bun run bench/ffi/ffi-all.ts",
115
+ "bench:newops": "bun bench/cost/rust-vs-js-new-ops.ts",
116
+ "bench:ffi:load": "bun run bench/ffi/ffi-load.ts",
117
+ "bench:ffi:public": "bun run bench/ffi/ffi-public.ts",
118
+ "bench:ffi:workers": "bun run bench/ffi/ffi-workers.ts",
119
+ "bench:margin": "bun run bench/ffi/ffi-margin.ts",
120
+ "bench:router": "bun run bench/cost/router-cost.ts",
121
+ "bench:task": "bun run bench/cost/task-offload.ts",
122
+ "bench:ingress-cost": "bun run bench/cost/ingress-cost.ts",
123
+ "bench:ingress-cost:post": "bun run bench/cost/ingress-cost-post.ts",
124
+ "verify:native:batch": "bun run scripts/verify-native-batch.ts"
125
+ },
126
+ "dependencies": {},
127
+ "peerDependencies": {
128
+ "@types/node": "^26.1.2"
129
+ },
130
+ "peerDependenciesMeta": {
131
+ "@types/node": {
132
+ "optional": true
133
+ }
134
+ },
135
+ "devDependencies": {
136
+ "@elysia/cors": "^1.4.2",
137
+ "@napi-rs/cli": "^3.8.6",
138
+ "@types/bun": "^1.3.14",
139
+ "@types/mime-types": "^3.0.1",
140
+ "autocannon": "^8.0.0",
141
+ "@types/validator": "^13.15.10",
142
+ "ajv": "^8.20.0",
143
+ "crc-32": "^1.2.2",
144
+ "dts-bundle-generator": "^9.5.1",
145
+ "elysia": "^1.4.29",
146
+ "fast-json-patch": "^3.1.1",
147
+ "mime-types": "^3.0.2",
148
+ "typescript": "7.0.2",
149
+ "validator": "^13.15.35"
150
+ },
151
+ "overrides": {
152
+ "typescript": "7.0.2",
153
+ "dts-bundle-generator": {
154
+ "typescript": "5.9.3"
143
155
  },
144
- "engines": {
145
- "bun": ">=1.1.0",
146
- "node": ">=20.3"
156
+ "@napi-rs/cli": {
157
+ "typescript": "6.0.3"
147
158
  },
148
- "napi": {
149
- "binaryName": "castrum",
150
- "targets": [
151
- "aarch64-apple-darwin",
152
- "aarch64-unknown-linux-gnu",
153
- "aarch64-unknown-linux-musl",
154
- "x86_64-apple-darwin",
155
- "x86_64-pc-windows-msvc",
156
- "x86_64-unknown-linux-gnu",
157
- "x86_64-unknown-linux-musl"
158
- ]
159
- }
160
- }
159
+ "hyperid": "^4.0.0"
160
+ },
161
+ "engines": {
162
+ "bun": ">=1.1.0",
163
+ "node": ">=20.3"
164
+ },
165
+ "napi": {
166
+ "binaryName": "castrum",
167
+ "targets": [
168
+ "aarch64-apple-darwin",
169
+ "aarch64-unknown-linux-gnu",
170
+ "aarch64-unknown-linux-musl",
171
+ "x86_64-apple-darwin",
172
+ "x86_64-pc-windows-msvc",
173
+ "x86_64-unknown-linux-gnu",
174
+ "x86_64-unknown-linux-musl"
175
+ ]
176
+ }
177
+ }