ferrijs-std 0.2.4

Node and web standard library for the ferrijs QuickJS runtime: WHATWG Streams, Events, AbortController, Buffer, crypto, fs, os, url, zlib and the capability model they enforce (partly derived from awslabs/llrt, Apache-2.0).
Documentation
[package]
name = "ferrijs-std"
description = "Node and web standard library for the ferrijs QuickJS runtime: WHATWG Streams, Events, AbortController, Buffer, crypto, fs, os, url, zlib and the capability model they enforce (partly derived from awslabs/llrt, Apache-2.0)."
version.workspace = true
# NOT the workspace's 2024, deliberately: most of this crate is vendored
# llrt, which is edition 2021. Under 2024 the match-ergonomics rule
# rejects an explicit `ref` inside an implicitly-borrowing pattern, which
# is exactly what two `stream_web` files do -- and `stream_web` is the one
# vendored tree that actually drifts upstream, so keeping it byte-identical
# is worth more than the newer edition in a crate whose own code is thin.
edition = "2021"
license = "Apache-2.0"
authors.workspace = true
repository.workspace = true
homepage.workspace = true

# Deliberately NOT `workspace = true`: this crate is vendored third-party
# code kept close to upstream so it can be re-synced. Reformatting it to
# the repo's house style (2-space indent, pedantic clippy) would make
# every future diff against awslabs/llrt unreadable.
[lints.rust]
unsafe_code = "allow"
# Upstream `llrt_abort` picks its sleep source between its own timers module
# and tokio. Only the tokio arm is vendored, so `sleep-timers` is declared as
# a known cfg rather than as a real feature: as a feature, `--all-features`
# would switch on an arm calling the `timers` module that is not vendored.
# `nightly` is set by upstream's build script (`llrt_build::set_nightly_cfg`),
# which is not vendored: this repo pins stable, so the nightly arms compile
# out. Declared so they stay compiling-out silently rather than warning.
unexpected_cfgs = { level = "warn", check-cfg = [
  'cfg(feature, values("sleep-timers"))',
  'cfg(nightly)',
  'cfg(rust_nightly)',
  'cfg(feature, values("crypto-openssl", "crypto-ring", "crypto-ring-rust", "crypto-graviola", "crypto-graviola-rust", "llrt_json"))',
] }

[lints.clippy]
correctness = { level = "deny", priority = -1 }
perf = { level = "deny", priority = -1 }
suspicious = { level = "deny", priority = -1 }

[features]
default = [
  "fs",
  "sleep-tokio",
  "system",
  "statistics",
  "network",
  "crypto-rust",
  "brotli-rust",
  "flate2-rust",
  "zstd-c",
]
fs = []
bytearray-buffer = []
sleep-tokio = []
# Upstream `llrt_crypto`'s feature names, so its `#[cfg]` arms stay exactly
# as upstream wrote them. Only the pure-Rust provider is vendored (its
# `ring` / `openssl` / `graviola` files are not), so those names are absent
# rather than off.
_subtle-full = []
_rustcrypto = ["_subtle-full"]
# Upstream's marker for the post-quantum and SHA-3 surface (ML-DSA, ML-KEM,
# the hybrid KEMs, ChaCha20-Poly1305, SHA3 / cSHAKE / TurboSHAKE), which
# every provider enables.
_modern-webcrypto = []
crypto-rust = ["_rustcrypto", "_modern-webcrypto"]

# Upstream `llrt_compression`'s own feature split, kept verbatim so its
# `#[cfg]` arms stay exactly as upstream wrote them. The `-c` variants
# link a system library; the `-rust` ones build from source, which is
# what this crate takes wherever a pure-Rust back-end exists. zstd has
# none (upstream says so in its own manifest), so `zstd-c` is the only
# way to have it -- and the `zstd` crate vendors and compiles the C
# rather than needing one installed, same as rquickjs-sys does.
brotli-c = ["brotlic"]
brotli-rust = ["brotli"]
flate2-c = ["flate2/zlib-ng"]
flate2-rust = ["flate2/zlib-rs"]
zstd-c = ["zstd"]
zstd-rust = ["zstd"]

# Upstream `llrt_os`'s own feature split over the `sysinfo` facilities the
# `os` module reads.
system = ["sysinfo/system"]
statistics = ["system"]
network = ["sysinfo/network", "system"]

[dependencies]
ferrijs-permissions = { workspace = true }
either = "1"
base64 = { workspace = true }
# `llrt_crypto` (crypto-rust provider) and the `llrt_json` it needs for JWK
# import/export. Versions match upstream's manifest at the vendored commit.
aes = "0.9"
# `hazmat` is what implements the 32/64-bit GCM tag sizes WebCrypto allows.
aes-gcm = { version = "0.11", features = ["alloc", "aes", "hazmat"], default-features = false }
aes-kw = { version = "0.3", features = ["oid"], default-features = false }
cbc = { version = "0.2", features = ["alloc"] }
chacha20poly1305 = { version = "0.11", features = ["alloc"], default-features = false }
const-oid = { version = "0.10", features = ["db"], default-features = false }
cshake = { version = "0.2", features = ["alloc"], default-features = false }
# Constant-time comparison for HMAC verification.
ctutils = { version = "0.4", default-features = false }
crc32c = { version = "0.6", default-features = false }
crc32fast = { version = "1", default-features = false }
ctr = { version = "0.10", default-features = false }
der = { version = "0.8", features = ["derive", "alloc"], default-features = false }
ecdsa = { version = "0.17", default-features = false }
ed25519-dalek = { version = "3.0.0", features = ["alloc", "pkcs8", "rand_core"], default-features = false }
elliptic-curve = { version = "0.14", features = ["alloc", "sec1"], default-features = false }
hkdf = { version = "0.13", default-features = false }
hmac = { version = "0.13", default-features = false }
keccak = { version = "0.2", default-features = false }
md-5 = { version = "0.11", features = ["alloc", "oid"], default-features = false }
ml-dsa = { version = "0.1", features = ["alloc", "pkcs8", "rand_core"], default-features = false }
ml-kem = { version = "0.3", features = ["alloc", "pkcs8"], default-features = false }
p256 = { version = "0.14", features = ["alloc", "ecdh", "ecdsa", "pkcs8"], default-features = false }
p384 = { version = "0.14.0", features = ["alloc", "ecdh", "ecdsa", "pkcs8"], default-features = false }
p521 = { version = "0.14.0", features = ["ecdh", "ecdsa", "pkcs8"], default-features = false }
pbkdf2 = { version = "0.13", default-features = false }
pkcs8 = { version = "0.11", features = ["alloc"], default-features = false }
rand = { version = "0.10", features = ["std", "std_rng", "thread_rng"], default-features = false }
rsa = { version = "0.10.0-rc.18", features = ["std", "sha2", "encoding"], default-features = false }
sha1 = { version = "0.11", features = ["alloc", "oid"], default-features = false }
sha2 = { version = "0.11", features = ["alloc", "oid"], default-features = false }
sha3 = { version = "0.12", default-features = false }
shake = { version = "0.1", default-features = false }
simd-json = { version = "0.18", features = ["big-int-as-float"], default-features = false }
spki = { version = "0.8", features = ["alloc"], default-features = false }
sponge-cursor = { version = "0.1", default-features = false }
x25519-dalek = { version = "3.0.0", features = ["static_secrets", "zeroize"], default-features = false }

base64-simd = { version = "0.8", features = ["alloc"], default-features = false }
hex-simd = { version = "0.8", features = ["alloc"], default-features = false }
itoa = { version = "1", default-features = false }
phf = { version = "0.14", features = ["macros"], default-features = false }
ryu = { version = "1", default-features = false }
half = { version = "2", default-features = false }
home = { version = "0.5", default-features = false }
memchr = "2"
num_cpus = { version = "1", default-features = false }
once_cell = { version = "1", features = ["std"], default-features = false }
sysinfo = { version = "0.39", default-features = false, optional = true }
# `half` backs `Float16Array`, which the vendored BYOB reader and
# `ObjectBytes` handle as of the latest llrt sync.
rquickjs = { workspace = true }
simdutf8 = { version = "0.1", features = ["std", "aarch64_neon"] }
url = { version = "2", features = ["std"], default-features = false }
# gzip / deflate for `CompressionStream` / `DecompressionStream` and for
# the `zlib` module.
flate2 = "1"
# `zlib`'s brotli and zstd codecs, via the vendored `llrt_compression`.
# Optional so the feature arms upstream wrote compile out unchanged.
brotli = { version = "9", features = ["std"], default-features = false, optional = true }
brotlic = { version = "0.8", default-features = false, optional = true }
zstd = { version = "0.14", default-features = false, optional = true }
# `urlToHttpOptions` decodes the credentials the way `decodeURIComponent`
# does; `url` keeps this crate private rather than re-exporting it.
percent-encoding = { version = "2", default-features = false, features = ["std"] }
tokio = { workspace = true }
tracing = { workspace = true }
# `tty` calls `isatty` on every platform, so this is not unix-only.
libc = { workspace = true }


# `utils/signals.rs` calls OpenProcess/TerminateProcess/CloseHandle and
# `fs/symlink.rs` creates junctions; both declarations upstream carries.
[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.61", features = [
  "Win32_Foundation",
  "Win32_System_Threading",
], default-features = false }
junction = "2"

[dev-dependencies]
tempfile = { workspace = true }
tokio = { workspace = true, features = ["full", "test-util"] }
uuid = { version = "1", features = ["v4"] }