Expand description
Node.js / Bun API compatibility runtime (bun_runtime crate).
Note: this module also defines a BaoRuntime type that is not the same
as the top-level crate::BaoRuntime (browser coordinator). Prefer the
top-level name for embedding; use bao::runtime:: for Node/Bun host setup.
Modules§
- bao_
browser_ global Bao.browserJS 全局对象 — 通过connect(url)暴露 CDP client。- bun_api
- bun_
build Bun.build(config)— JS face + native-bundler bridge (BuildTasklet).- bun_
builtins - bun_ffi
- bun_
glob_ api - bun_
hash_ api - bun_
inspect_ api - bun_
listen - Bun.listen / Bun.connect / Bun.udpSocket — bridge to bun_uws + bun_uws_sys.
- bun_
mime_ api - bun_
password - bun_
serde_ api - bun_
shell - Bun.Shell / Bun.$ — bridge to bun_shell_parser + bun_spawn.
- bun_
spawn_ sync - bun_
sqlite - bun_
test - bun_udp
- Bun.udpSocket — bridge to bun_uws_sys::udp::Socket.
- bun_
util_ api - dispatch
- Link-time extern implementations for
EventLoopTimerandFilePoll. - fetch_
api - fetch_
async - Async fetch/HTTP integration with the event loop (FetchTasklet pattern).
- gc_
store - globals
- h3_
fetch - HTTP/3 (h3) fetch 能力补全模块。
- http_
client - Synchronous HTTP client bridge using bun_http::AsyncHTTP::init_sync + send_sync().
- install
- Package manager integration — mirrors
bun_runtime::cli::install_command::install_with_cli(). - ipc_
channel - linux_
trace - Process-wide Linux ftrace / portable perf-trace backend for
Bun__linux_trace_{init,emit,close}. - node_
async_ hooks - node_
buffer - node_
child_ process - node_
cluster - node_
console - node_
constants - node_
crypto - node_
dgram - node_
diagnostics_ channel - node_
dns - node_
domain - node_
events - node_fs
- node_
http - node_
http2 - node_
http2_ upgrade - node_
https - node_
inspector - node_
inspector_ promises - node_
internal_ http - node_
internal_ streams - node_
module - node_
net - node:net implementation using bun_uws uSockets TCP socket API.
- node_os
- node_
path - node_
perf_ hooks - node_
punycode - node_
querystring - node_
readline - node_
repl - node_
stream - node_
stream_ consumers - node_
stream_ web - node_
string_ decoder - node_
stubs - node_
subpath_ aliases - node_
sys - node_
test - node:test module — bridges to the existing
globalThis.__bun_test_moduleinstalled bybun_test.rs. - node_
timers_ module - node_
tls - node_
tls_ common - node_
tls_ wrap - node_
trace_ events - node_
tty - node_
url - node_
util - node_
util_ types - node_vm
- node:vm module — SpiderMonkey Realm-isolated sandbox implementation.
- node_
wasi - node:wasi module — WASI preview1 implementation via JS IIFE.
- node_
worker_ threads - node_
zlib - permission_
bridge - product_
buffered_ reader - True
BufferedReaderParentLinkowners for product residual variants. - product_
native_ symbols - Residual
#[no_mangle]symbols formerly provided only via thebao_native_stubshard-dep. Living here lets the default product path drop that hard-dep / force_link anchor. - product_
process_ exit - True
ProcessExitowners for product residual variants. - require
- resolver_
bridge - Resolver bridge: replaces hand-written resolve_specifier with bun_resolver::Resolver.
- runtime
- s3_api
- stealth_
http - timers
- uncaught
- web_api
- web_
fetch_ classes - web_
streams - workflow_
host_ global - Re-export thin
bao_workflow_hostinject (plan-25). Implementation lives inbao_workflow_hostso tests can run without dual-def link.
Structs§
Functions§
- clear_
exit - Clear the exit flag. Used by test runner between test files so one file’s process.exit() doesn’t affect subsequent files.
- exit_
code - Return the exit code set by process.exit() / Bun.exit().
- force_
link_ bun_ install - Force-link
bun_installcompilation unit so the linker resolves__bun_resolver_init_package_managerfrombun_install::auto_installer. - install_
exit_ handler - Install orderly shutdown hooks for SpiderMonkey.
- js_
to_ ⚠rust_ string - Safe JS string conversion: returns “” if JS string allocation fails.
- jsstr_
to_ ⚠rust_ string - Safe JSString pointer conversion: returns “” if pointer is null.
- request_
exit - Request process exit with the given code. Called by process.exit() and Bun.exit().
- set_
exit_ code - Set only the exit code without requesting an exit.
Backs the
process.exitCodeproperty setter: assigning the property alone steers the final exit code (honoured on natural exit and by ‘exit’ listeners), while the process keeps running until the event loop drains or process.exit() is called — Node semantics. - should_
exit - Check whether process.exit() or Bun.exit() was called.
- shutdown_
engine - Shut down the SpiderMonkey engine entirely (process exit only).
- shutdown_
thread_ sm - Shut down SpiderMonkey Runtime on the current thread.