Repository navigation
node:v8: modern diagnostics and profiler helper exports are missing from the ESM surface #3904
Description
Summary
Perry's current node:v8 manifest omits several named exports that Node exposes in the ESM namespace. Code that imports modern V8 diagnostics/profiling helpers works in Node but fails Perry check before runtime.
Baseline: 22824ba90abf Expose globalThis.EventTarget (#3628).
This complements the existing focused issues for heap snapshot output (#3140), startup snapshots (#3141), and promise hooks (#3139). This issue is specifically about the missing public named exports and parity coverage for the remaining modern helper surface.
Current manifest gap
target/release/perry --print-api-manifest reports these node:v8 module exports today:
serialize
deserialize
getHeapStatistics
getHeapCodeStatistics
getHeapSpaceStatistics
cachedDataVersionTag
GCProfiler
Serializer
DefaultSerializer
Deserializer
DefaultDeserializer
startupSnapshot
promiseHooks
setFlagsFromString
takeCoverage
stopCoverage
setHeapSnapshotNearHeapLimit
Node v25.9.0 exposes additional named exports:
getCppHeapStatistics
getHeapSnapshot
isStringOneByteRepresentation
queryObjects
startCpuProfile
writeHeapSnapshot
default
getHeapSnapshot and writeHeapSnapshot overlap with #3140. The other helpers are not covered by the existing node:v8 issues found during triage.
Probe
import {
getCppHeapStatistics,
getHeapSnapshot,
isStringOneByteRepresentation,
queryObjects,
startCpuProfile,
writeHeapSnapshot,
} from "node:v8";
for (const [name, value] of [
["getCppHeapStatistics", getCppHeapStatistics],
["getHeapSnapshot", getHeapSnapshot],
["isStringOneByteRepresentation", isStringOneByteRepresentation],
["queryObjects", queryObjects],
["startCpuProfile", startCpuProfile],
["writeHeapSnapshot", writeHeapSnapshot],
] as const) {
console.log(name, typeof value);
}Node behavior
Node v25.9.0:
getCppHeapStatistics function
getHeapSnapshot function
isStringOneByteRepresentation function
queryObjects function
startCpuProfile function
writeHeapSnapshot function
Perry behavior
target/release/perry check tmp-v8-modern-export-probe.ts:
Checking 1 file(s)...
error[U006]: The requested module 'node:v8' does not provide an export named 'getCppHeapStatistics'
--> /private/tmp/perry-node-compat-main/tmp-v8-modern-export-probe.ts:2:4
|
2 | getCppHeapStatistics,
Check failed: 1 error(s), 0 warning(s)
| ^^^^^^^^^^^^^^^^^^^^
Error: Check failed with errors
Suggested scope
- Add/track
getCppHeapStatistics(). - Add/track
isStringOneByteRepresentation(value). - Add/track
queryObjects(constructor[, options]). - Add/track
startCpuProfile([title]). - Ensure the heap snapshot named exports are included in the manifest/export shape as part of node:v8: implement heap snapshot output #3140 or this cut.
- Add Node-vs-Perry parity fixtures that at minimum prove these names are importable and function-valued.
Acceptance
- Perry accepts named ESM imports for Node's current
node:v8helper tail listed above. - Namespace shape matches Node for the covered names, including
typeofand basic presence checks. - For helpers implemented as stubs initially, the thrown error shape is intentionally tracked and does not masquerade as a missing export.
getHeapSnapshot/writeHeapSnapshotexport-shape work is coordinated with node:v8: implement heap snapshot output #3140 so the public names and runtime contracts converge together.- Generated manifest/docs/DTS include the same supported public
node:v8exports.
No Test262 scope; this is Node API compatibility.
Activity
fix(v8): expose modern diagnostics/profiler named exports (#3904)
fix(v8): expose modern diagnostics/profiler named exports (#3904) (#4012
fix(node): enumerate native-module export surface for tty/v8/perf_hoo…