feat(process): implement process.features (#1378) - #1474
Merged
Conversation
Node's `process.features` is an object of boolean capability flags (`tls`, `ipv6`, `inspector`, `openssl_is_boringssl`, ...) — consumers branch on individual fields to detect what the runtime links in. Perry was returning a 0 sentinel, so reading any field came back `undefined`. Lowered in `expr_member.rs` (both bare `process.features` and the `globalThis.process.features` paths) to an inline `Expr::Object` literal built by a new `process_features_literal()` helper. Values reflect what Perry's runtime actually supports — TLS/IPv6 true, inspector/debug/boringssl/quic false, `typescript: "transform"` to distinguish Perry's native TS compilation from Node's `"strip"` mode. Test: test-parity/node-suite/process/features/features.ts asserts *shape* (typeof per field) rather than specific values, so the parity check survives any future Node version bumping individual flags.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Node's
process.featuresis an object of boolean capability flags (tls,ipv6,inspector,openssl_is_boringssl, ...) — consumers branch on individual fields to detect what the runtime links in. Perry was returning a 0 sentinel, so reading any field came backundefined.Closes #1378.
Changes
expr_member.rs: both the bareprocess.featuresandglobalThis.process.featurespaths lower to an inlineExpr::Objectliteral built by a newprocess_features_literal()helper.Values reflect what Perry's runtime actually supports —
tls/ipv6/tls_alpn/tls_sni/tls_ocsptrue,inspector/debug/uv/openssl_is_boringssl/cached_builtins/require_module/quicfalse.typescript: "transform"distinguishes Perry's native (AOT) TS compilation from Node's"strip"mode.Sits next to the
release/execArgvarms shipped in #1348 / #1349.Test plan
test-parity/node-suite/process/features/features.tsasserts shape (typeof per field) rather than specific values, so the parity check survives any future Node version bumping individual flags.node --experimental-strip-typeson the typeof assertions.cargo fmt --all -- --checkclean.