Expand description
MiniEventLoop: A lightweight event loop for non-JavaScript contexts
This is a simplified version of jsc.EventLoop that provides event loop functionality
without requiring a JavaScript runtime. It enables code reuse between JavaScript-enabled
contexts (like bun run) and JavaScript-free contexts (like bun build, bun install,
and the Bun Shell).
Key characteristics:
- Wraps the uSockets event loop, same as jsc.EventLoop
- Supports concurrent task execution via thread pools
- Provides file polling capabilities for watching filesystem changes
- Manages stdout/stderr streams without JavaScript bindings
- Handles environment variable loading and management
Use cases:
- Build processes that need async I/O without JavaScript execution
- Package installation with concurrent network requests
- Shell command execution with proper I/O handling
- Any Bun subsystem that needs event-driven architecture without JS overhead
Structs§
Enums§
Constants§
Traits§
- AbstractVM
- Zig
AbstractVM(inner: anytype)dispatches on@TypeOf(inner)to wrap either a*VirtualMachineor a*MiniEventLoop. Rust models this as a trait implemented for both. - Event
Loop KindT
Functions§
- __
bun_ stdio_ blob_ store_ new - Constructs a
webcore::blob::Storefor stdout/stderr/stdin (Zig rare_data.zig:551 inlineBlob.Storector). Return value is an erased*mut blob::Storewith intrusive refcount = 2; this crate only stores/forwards it. Defined inbun_runtime::webcore::blob. No caller-side preconditions (by-value args, allocates fresh). - init_
global - Returns the thread-local
*mut MiniEventLoop(Zig:*MiniEventLoop).
Type Aliases§
- Concurrent
Task Queue - Intrusive MPSC queue over
AnyTaskWithExtraContextlinked via its.nextfield. - Pipe
Read Buffer - Platform
Event Loop - The platform’s native event loop type. Zig:
jsc.PlatformEventLoop. - Task