Skip to main content

Module runtime

Module runtime 

Source
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.browser JS 全局对象 — 通过 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 EventLoopTimer and FilePoll.
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_module installed by bun_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 BufferedReaderParentLink owners for product residual variants.
product_native_symbols
Residual #[no_mangle] symbols formerly provided only via the bao_native_stubs hard-dep. Living here lets the default product path drop that hard-dep / force_link anchor.
product_process_exit
True ProcessExit owners 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_host inject (plan-25). Implementation lives in bao_workflow_host so tests can run without dual-def link.

Structs§

BaoRuntime

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_install compilation unit so the linker resolves __bun_resolver_init_package_manager from bun_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.exitCode property 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.