Skip to content

Add Node.js constants#6568

Merged
danlapid merged 1 commit into
mainfrom
dlapid/addNodeConstants
Apr 13, 2026
Merged

Add Node.js constants#6568
danlapid merged 1 commit into
mainfrom
dlapid/addNodeConstants

Conversation

@danlapid

Copy link
Copy Markdown
Collaborator

No description provided.

@danlapid danlapid requested review from a team as code owners April 12, 2026 22:21
@danlapid danlapid requested review from jasnell and npaun April 12, 2026 22:21

@ask-bonk ask-bonk Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm Bonk, and I've done a quick review of your PR.

This PR adds a large set of Node.js compatibility constants across multiple modules (async_hooks, process, sqlite, zlib, http2, events, _http_common, constants). Overall the approach is correct — exposing stub constants for compat — but I found a few accuracy issues against current Node.js main.

  1. [MED] process.features.uv is true but workerd does not use libuv
  2. [MED] process.versions includes cjs_module_lexer which is not a process.versions key in Node.js
  3. [LOW] process.versions is missing ngtcp2 and nghttp3 which are in Node.js NODE_VERSIONS_KEYS_BASE
  4. [LOW] asyncWrapProviders includes QUIC_PACKET: 68 which does not exist in current Node.js main async_wrap.h

This review was generated by an AI code review assistant and may contain inaccuracies.

Comment thread src/node/internal/internal_process.ts
Comment thread src/workerd/api/node/process.c++
Comment thread src/node/async_hooks.ts Outdated
@ask-bonk

ask-bonk Bot commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

I'm Bonk, and I've done a quick review of your PR.

This PR adds Node.js compatibility constants across multiple modules (async_hooks, process, sqlite, zlib, http2, events, _http_common, constants). I verified the constant values against current Node.js main source and found 4 issues:

  1. [MED] process.features.uv: true — workerd uses KJ's event loop, not libuv. This should be false.
  2. [MED] process.versions includes cjs_module_lexer — this is not a real process.versions key in Node.js (verified against src/node_metadata.h).
  3. [LOW] process.versions is missing ngtcp2 and nghttp3 which are present in Node.js NODE_VERSIONS_KEYS_BASE.
  4. [LOW] asyncWrapProviders includes QUIC_PACKET: 68 which does not exist in current Node.js main src/async_wrap.h.

All findings have been posted as inline review comments on PR #6568 with suggestions where applicable.

github run

Comment thread src/node/async_hooks.ts Outdated
@codspeed-hq

codspeed-hq Bot commented Apr 12, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 14.07%

⚡ 1 improved benchmark
✅ 69 untouched benchmarks
⏩ 129 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
Encode_ASCII_256[TextEncoder][0/0/256] 3.1 ms 2.7 ms +14.07%

Comparing dlapid/addNodeConstants (5f18390) with main (c649a48)

Open in CodSpeed

Footnotes

  1. 129 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Comment thread src/workerd/api/node/process.c++
@danlapid danlapid force-pushed the dlapid/addNodeConstants branch from 1511e18 to 5f18390 Compare April 12, 2026 23:44
@danlapid danlapid enabled auto-merge April 13, 2026 00:15
@danlapid danlapid merged commit 6c76136 into main Apr 13, 2026
32 of 34 checks passed
@danlapid danlapid deleted the dlapid/addNodeConstants branch April 13, 2026 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants