Expand description
ferrijs: an embeddable JavaScript runtime on QuickJS.
A Runtime is one sandboxed realm: the engine, its context, the
single event loop that owns them, and the policy they run under.
Build one with Runtime::builder, granting what the program may
reach through Permissions and bounding what it may consume
through Limits; add host API as Extensions; then
Runtime::eval_script a script, Runtime::eval_module a
compiled module, or Runtime::run a body of your own under the
same bracket.
What every realm has: the web-standard globals (URL, fetch,
Streams, crypto, TextEncoder, AbortController, Blob,
structuredClone, …), the timer globals, console, process
and require, and the Node modules (node:fs, node:path,
node:buffer, node:crypto, node:events, node:util,
node:zlib, …) under the same names Node serves them. Every one of
them answers to the realm’s permissions.
Re-exports§
pub use console::ConsoleCapture;pub use console::ConsoleSink;pub use error::ScriptError;pub use error::ScriptErrorKind;pub use extension::Extension;pub use extension::FnExtension;pub use limits::Deadline;pub use limits::Limits;pub use limits::PauseClock;pub use limits::RunOptions;pub use modules::ModulePolicy;pub use modules::ModuleRegistry;pub use modules::NativeModule;pub use modules::RequireHook;pub use realm::RealmOptions;pub use redact::Redactor;pub use redact::Secrets;pub use result::ConsoleEntry;pub use result::ConsoleLevel;pub use result::Outcome;pub use result::ScriptResult;pub use result::ScriptSuccess;pub use runtime::Builder;pub use runtime::Config;pub use runtime::ConsoleOptions;pub use runtime::ProcessOptions;pub use runtime::Run;pub use runtime::RunBody;pub use runtime::Runtime;pub use runtime::eval_bytecode;pub use runtime::install_args;pub use runtime::module_body;pub use runtime::script_body;pub use runtime::vm_handle;pub use source_map::CompiledModule;pub use source_map::LazyMap;pub use source_map::SourceMapper;pub use vm::VmHandle;pub use ferrijs_permissions as permissions;pub use ferrijs_std as std;pub use rquickjs;
Modules§
- console
- Captured
console.*output with size limits. - console_
fmt - The
consoleglobal: Node’s surface, rendering, and colours. - error
- Script execution errors with source-level diagnostics.
- extension
- How a host adds its own API to a realm.
- fetch
- A WHATWG
fetch+Headers+Request+Response, so code that expectsfetchworks. It is a thin surface over theferrijs-fetchengine, reached through aFetchBackendthe host chooses — one HTTP stack, one place the net policy applies. - limits
- Resource ceilings, and the deadline the interrupt handler reads.
- modules
- How a realm finds the modules a program imports.
- realm
- What a realm looks like before any script runs: which globals exist, and whether the language’s own escape hatches are open.
- redact
- Values that must not reach a caller verbatim.
- result
- Structured result of one run.
- runtime
- One sandboxed realm: a
QuickJSruntime, its context, the event loop that owns them, and the policy they run under. - source_
map - Where in the user’s source a position in a bundle came from.
- timers
- The timer globals.
- value
- Conversions between Rust values and
rquickjsvalues. - vm
- Single-owner VM event loop.
Macros§
- vm_with
VmHandle::withwithasync_with!ergonomics: the body runs on the VM event loop with$ctx: Ctx<'js>in scope.
Structs§
- Container
- The policy for one realm, plus the hook and audit the host attached.
- Denied
- A refused request. Carries what Node’s
ERR_ACCESS_DENIEDcarries: the kind and the resource, so a host can render either its own message or Node’s. - Identity
- The runtime’s name and version as scripts see them.
- Permissions
- The policy for one realm.
Enums§
- SysInfo
- One fact about the host a
sysgrant can cover.