Skip to content

node builtins: defer cross-module requires and load-time work - #35541

Open
Jarred-Sumner wants to merge 5 commits into
mainfrom
claude/faster-builtin-loading
Open

node builtins: defer cross-module requires and load-time work#35541
Jarred-Sumner wants to merge 5 commits into
mainfrom
claude/faster-builtin-loading

node builtins: defer cross-module requires and drop eager load-time work

405d205
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 25, 2026 in 15m 11s

Code review found 2 potential issues

Found 5 candidates, confirmed 2. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 2
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/js/internal/primordials.js:172-183 primordials Safe* built lazily — tamper-resistance window widened
🟡 Nit src/js/internal/stream.ts:4-7 Dead code: ObjectKeys unused in internal/stream.ts

Annotations

Check warning on line 183 in src/js/internal/primordials.js

See this annotation in the file changed.

@claude claude / Claude Code Review

primordials Safe* built lazily — tamper-resistance window widened

Wrapping `SafeMap`/`SafeSet`/`SafeWeakMap`/`SafeWeakSet` and the `*PrototypeGetSize` getters in `defineLazy()` moves `makeSafe()`/`getGetter()`'s prototype snapshot from primordials-load to first-property-access, so a builtin loading primordials no longer immunizes the `Safe*` entries it doesn't touch (e.g. `readable.ts`'s `SafeSet` now snapshots on the first multi-dest `.pipe()` rather than at module load). Bun's primordials was already load-order-dependent and none of the affected sites are se

Check warning on line 7 in src/js/internal/stream.ts

See this annotation in the file changed.

@claude claude / Claude Code Review

Dead code: ObjectKeys unused in internal/stream.ts

`const ObjectKeys = Object.keys;` is now dead — the two loops that referenced it (`ObjectKeys(streamReturningOperators)` / `ObjectKeys(promiseReturningOperators)`) were moved into `internal/streams/readable.ts` in this PR, leaving no remaining uses in this file. Per REVIEW.md ("Delete dead code in the same PR that makes it dead"), drop the binding.