Skip to main content

Crate brrrty_node

Crate brrrty_node 

Source
Expand description

Runs an Eleventy site’s JavaScript data files in the site’s own Node.

One Node process per build runs a worker module embedded in this crate. Brrrty sends it JSON requests on stdin; it answers on stdout with framed replies, the values encoded exactly (see worker/encode.mjs) or refused.

Re-exports§

pub use decode::decode;

Modules§

decode
The worker’s wire forms (see worker/encode.mjs), decoded into Brrrty values. Anything not exactly one of the forms is an error: the worker and this file are one protocol, so a mismatch is a bug, never data.
stack
Where a JavaScript error happened, from V8’s stack text: the first frame inside the project and outside node_modules, else the first frame.

Structs§

NodeInfo
A Node that can run the worker.
Worker
A running worker. Dropping it closes Node’s stdin, waits up to 2 s for it to exit, then kills it.
WorkerError
Node couldn’t be started.

Enums§

NodeMissing
Why there is no Node to run the data with.
RunMode
How 11ty was started, as ELEVENTY_RUN_MODE shows it.

Constants§

ENCODE_SOURCE
The worker’s value encoding, as JavaScript source.
MIN_NODE
11ty 3’s own floor.

Functions§

encode
A Brrrty value in the worker’s wire forms.
find_node
Find Node: env_override (the value of BRRRTY_NODE) when set, else node on PATH.
parse_version
v24.22.3 (or 24.22.3) as numbers.
stop_all
Kill every running worker and what it started, at once: for Ctrl-C, SIGTERM and a panic. Safe to call from a signal handler thread.