1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
//! Vendored subset of [awslabs/llrt](https://github.com/awslabs/llrt)
//! (Apache-2.0): the WHATWG Streams implementation plus the pieces it
//! needs (`llrt_utils`, `llrt_events`, `llrt_exceptions`, `llrt_abort`).
//!
//! Upstream crate -> module here:
//!
//! | upstream | module |
//! |---------------------|---------------|
//! | `llrt_utils` | [`utils`] |
//! | `llrt_context` | [`context`] |
//! | `llrt_exceptions` | [`exceptions`]|
//! | `llrt_events` | [`events`] |
//! | `llrt_abort` | [`abort`] |
//! | `llrt_os` | [`os`] |
//! | `llrt_fs` | [`fs`] |
//! | `llrt_path` (helpers)| [`pathutil`] |
//! | `llrt_encoding` | [`encoding`] |
//! | `llrt_buffer` | [`buffer`] |
//! | `llrt_json` | [`json`] |
//! | `llrt_crypto` | [`crypto`] |
//! | `llrt_stream_web` | [`stream_web`]|
//! | `llrt_zlib` | [`zlib`] |
//! | `llrt_compression` | [`compression`]|
//! | `llrt_string_decoder`| [`string_decoder`]|
//! | `llrt_perf_hooks` | [`perf_hooks`]|
//! | `llrt_tty` | [`tty`] |
//! | `llrt_navigator` | [`navigator`] |
//! | `llrt_url` | [`url`] |
//! | `llrt_util` (codecs)| [`text`] |
//! | `llrt_test` | `test` (dev) |
//!
//! Sources are kept byte-close to upstream — only `crate::` / `llrt_*`
//! path prefixes are rewritten — so a re-sync stays a mechanical diff.
//! Host-specific behaviour belongs in the embedding runtime, not here.
/// Codec back-ends behind `zlib` (upstream `llrt_compression`).
/// Node modules this crate implements itself, because upstream llrt has
/// none or only a stub. Written to the repo's style, but compiled under
/// this crate's relaxed lints: pedantic's `needless_pass_by_value` is
/// unsatisfiable for rquickjs callback signatures, which must take owned
/// JS values.
/// Path helpers the vendored `fs` needs (upstream `llrt_path`). The
/// `path` MODULE is this crate's own; only these Rust helpers come from
/// upstream, so `fs` stays byte-close to it.
/// Web-platform globals with no upstream in llrt, written here so the
/// runtime has exactly one implementation of each.
use ;
/// Install every web-standard global on `ctx`: `DOMException`, `Event` /
/// `EventTarget`, `AbortController` / `AbortSignal`, the full Streams
/// surface, `Buffer` / `Blob` / `File`, `crypto`, the text codecs,
/// `URL` / `URLSearchParams`, `atob` / `btoa`, `structuredClone`,
/// `performance`, `FormData`, the compression streams and `navigator`.
///
/// One entry point, so a host cannot install half the crate. What is
/// deliberately NOT here: the timers (they carry host state, see
/// [`web::timers`]), `process` (its `env` and `cwd` are the host's to
/// supply, see [`node::process`]), the Node modules (served through
/// [`modules::modules`] by the host's loader) and an `fs` global (Node
/// has none; [`fs::init`] is the opt-in).