Skip to content

node:v8: modern diagnostics and profiler helper exports are missing from the ESM surface #3904

Closed

Description

@andrewtdiz

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:v8 helper tail listed above.
  • Namespace shape matches Node for the covered names, including typeof and 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 / writeHeapSnapshot export-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:v8 exports.

No Test262 scope; this is Node API compatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions