bun_runtime 0.1.0

Bao runtime integration — JS engine + Bun API + event loop
[package]
name = "bun_runtime"
version = "0.1.0"
description = "Bao runtime integration — JS engine + Bun API + event loop"
edition.workspace = true
license.workspace = true

[dependencies]
bao_engine = { path = "../bao_engine", version = "0.1.0" }
bao_workflow_host = { path = "../bao_workflow_host", version = "0.1.0" }
bao_stealth = { path = "../bao_stealth", version = "0.1.0" }
bao_boringssl_bridge = { path = "../bao_boringssl_bridge", version = "0.1.0" }
bun_boringssl_sys = { path = "../boringssl_sys", version = "0.1.0" }
bao_crypto = { path = "../bao_crypto", version = "0.1.0" }
bao_cdp_client = { path = "../bao_cdp_client", version = "0.1.0" }
mozjs.workspace = true
mozjs_sys.workspace = true
log = "0.4"
libc = "0.2"
rusqlite = { version = "0.38", features = ["bundled"] }
libffi = "3"
serde_json = "1"
dashmap.workspace = true

# Package manager (auto-install, lockfile, npm registry)
# @trace STUB-INVENTORY: default product must NOT hard-dep bao_native_stubs.
# Closed-set residual dispatch → product_dispatch_residual.rs; C libs →
# force_link_native_c_libs. RealImpl still only in stubs = residual owner task.
bun_install = { path = "../install", version = "0.1.0" }

# Bun 纯 Rust crate(L0-L3 层,零 JSC 依赖)
bun_http = { path = "../http", version = "0.1.0" }
bun_http_types = { path = "../http_types", version = "0.1.0" }
bun_threading = { path = "../threading", version = "0.1.0" }
bun_core = { path = "../bun_core", version = "0.1.0" }
bun_url = { path = "../url", version = "0.1.0" }
bun_uws = { path = "../uws", version = "0.1.0" }
bun_uws_sys = { path = "../uws_sys", version = "0.1.0" }
# @trace REQ-ENG-006 [api:Bun.semver.order] — Bun's own semver implementation
# (parse + orderWithoutBuild), the same engine install/resolver use.
bun_semver = { path = "../semver", version = "0.1.0" }
# Real owner of liblsquic.a / liblshpack.a — product force_link (not via stubs).
# @trace STUB-INVENTORY: replaces bao_native_stubs::force_c_lib_stubs lsquic leg
bun_lsquic_sys = { path = "../lsquic_sys", version = "0.1.0" }
bun_spawn = { path = "../spawn", version = "0.1.0" }
bun_spawn_sys = { path = "../spawn_sys", version = "0.1.0" }
# @trace REQ-BAO-API-018 [dep:bun_shell_parser] — Shell lexer/parser/AST (replaces hand-written shell parsing)
bun_shell_parser = { path = "../shell_parser", version = "0.1.0" }
# @trace REQ-BAO-API-018 [dep:bun_alloc] — Arena allocator for bun_shell_parser Lexer/Parser
bun_alloc = { path = "../bun_alloc", version = "0.1.0" }
bun_sys = { path = "../sys", version = "0.1.0" }
bun_opaque = { path = "../opaque", version = "0.1.0" }
bun_picohttp = { path = "../picohttp", version = "0.1.0" }
bun_resolver = { path = "../resolver", version = "0.1.0" }
bun_ast = { path = "../ast", version = "0.1.0" }
bun_event_loop = { path = "../event_loop", version = "0.1.0" }
bun_dns = { path = "../dns", version = "0.1.0" }
bun_cares_sys = { path = "../cares_sys", version = "0.1.0" }
bun_io = { path = "../io", version = "0.1.0" }
bun_base64 = { path = "../base64", version = "0.1.0" }
bun_s3_signing = { path = "../s3_signing", version = "0.1.0" }
# @trace REQ-ENG-007 [code:bun_simdutf_sys] — SIMD-accelerated UTF-8/ASCII
# validation for Buffer.isUtf8 / Buffer.isAscii. Replaces the hand-written
# byte-by-byte RFC 3629 DFA in node_buffer.rs with bun_simdutf_sys::validate_*
# (FFI to bun-simdutf.cpp, ~3-10× faster on AVX2/NEON).
bun_simdutf_sys = { path = "../simdutf_sys", version = "0.1.0" }
# @trace REQ-ENG-007 [code:bun_paths] — POSIX path normalization primitives
# for node:path (resolve/normalize/join/relative). Replaces the std::path-
# based helpers in node_path.rs with bun_paths::resolve_path (Zig-parity
# normalize_string / join / join_abs_string).
bun_paths = { path = "../paths", version = "0.1.0" }
# @trace REQ-ENG-007 [code:bun_glob] — fs.glob/globSync engine (GlobWalker,
# the Bun-faithful `**`/brace/dot walker). Replaces the hand-written
# glob_walk/glob_match in node_fs.rs which ignored options.cwd entirely.
bun_glob = { path = "../glob", version = "0.1.0" }
bytes.workspace = true
compact_str.workspace = true
smallvec.workspace = true
bao_uloop = { path = "../bao_uloop", version = "0.1.0" }
bun_sha_hmac = { path = "../sha_hmac", version = "0.1.0" }
# @trace REQ-BAO-API-010 [dep:bun_hash] — non-cryptographic hash (adler32, xxhash, cityhash, etc.)
bun_hash = { path = "../hash", version = "0.1.0" }
# @trace REQ-ENG-006 [dep:bun_wyhash] — Bun.hash default algorithm (std.hash.Wyhash
# final4, seed 0). Same crate the parser/router HashMaps use.
bun_wyhash = { path = "../wyhash", version = "0.1.0" }
# @trace REQ-ENG-006 [dep:bun_parsers] — Bun.TOML.parse / Bun.YAML.parse /
# Bun.JSONC.parse bridge (upstream TOML/YAML/JSON5 Expr-tree parsers; already
# in the dep tree via bun_install).
bun_parsers.workspace = true
# @trace REQ-ENG-006 [dep:unicode-width] — Bun.stringWidth per-codepoint
# widths (UAX#11: wide/fullwidth = 2, combining/control = 0). Already in the
# tree via swc_common; bun_core's C++ visible-width FFI has no linked C++
# object in bao, so the Rust crate is the engine here.
unicode-width = "0.2"
# @trace REQ-BAO-API-010 [dep:crc32fast] — CRC32 via crc32fast (same backend as bun_zlib)
crc32fast.workspace = true
# @trace REQ-ENG-014 [dep:argon2] — password hashing (argon2id/argon2i/argon2d via rust-argon2)
# Workspace key is `rust-argon2` (matches package name); crate name is `argon2`.
rust-argon2.workspace = true
# @trace REQ-ENG-014 [dep:bcrypt] — password hashing (bcrypt)
bcrypt = { workspace = true }
# @trace REQ-ENG-014 [dep:getrandom] — salt generation for password hashing
getrandom = { workspace = true }
hex = "0.4"
flate2.workspace = true
bun_brotli = { path = "../brotli", version = "0.1.0" }
# @trace REQ-ENG-007 [dep:bun_zlib] — node:zlib sync decompress routes through
# the same streaming state machine as the HTTP pipeline (multi-member gzip,
# per-member CRC/ISIZE, node-classified failure reasons).
bun_zlib = { path = "../zlib", version = "0.1.0" }
# @trace STUB-INVENTORY: real __bun_regex_* for PnpmMatcher (was always-fail noop)
regex = "1"

[dev-dependencies]
bao_engine = { path = "../bao_engine", version = "0.1.0" }
bao_uloop = { path = "../bao_uloop", version = "0.1.0" }
bao_cdp = { path = "../bao_cdp", version = "0.1.0" }
cdp-server = { path = "../cdp-server", version = "0.1.0" }
tempfile = "3"
# Bun.build e2e: registers the native bundle driver (full bun_bundler
# pipeline). Dev-only dep — a NORMAL dep would cycle
# (bao_bundler → bun_runtime → bao_bundler); dev-dep cycles are legal and the
# product installs the same driver from bao_cli::run().
# PUBLISH-STRIP: cyclic dev-dep (bao_bundler normal-deps bun_runtime); restore after W2 wave.
# Do NOT dev-dep bao_native_stubs: product residual + product_native_symbols +
# product_buffered_reader own the closed-set / RealImpl symbols; co-linking
# stubs dual-defs (STUB-INVENTORY dual-def iron rule). Tests force-link via
# bao_uloop / product #[used] anchors only.

# Node.js conformance suite (ported from ~/code/rust/bun/test/js/node/, MIT).
# Lives in a subdirectory so each module is a separate test binary.
[[test]]
name = "buffer_conformance"
path = "tests/node_conformance/buffer_conformance.rs"

[[test]]
name = "path_conformance"
path = "tests/node_conformance/path_conformance.rs"

[[test]]
name = "fs_conformance"
path = "tests/node_conformance/fs_conformance.rs"

[[test]]
name = "crypto_conformance"
path = "tests/node_conformance/crypto_conformance.rs"

[[test]]
name = "url_conformance"
path = "tests/node_conformance/url_conformance.rs"

[[test]]
name = "events_conformance"
path = "tests/node_conformance/events_conformance.rs"

[[test]]
name = "assert_conformance"
path = "tests/node_conformance/assert_conformance.rs"

[[test]]
name = "util_conformance"
path = "tests/node_conformance/util_conformance.rs"

[[test]]
name = "stream_conformance"
path = "tests/node_conformance/stream_conformance.rs"

[[test]]
name = "http_conformance"
path = "tests/node_conformance/http_conformance.rs"

[[test]]
name = "fetch_c13_minimal"
path = "tests/fetch_c13_minimal.rs"

[[test]]
name = "fetch_e2e_tests"
path = "tests/fetch_e2e_tests.rs"

[[test]]
name = "bun_build_e2e_tests"
path = "tests/bun_build_e2e_tests.rs"

[[test]]
name = "fs_watch_events_tests"
path = "tests/fs_watch_events_tests.rs"

[[test]]
name = "cluster_pump_loop_tests"
path = "tests/cluster_pump_loop_tests.rs"