// node:v8: only what packages probe at load. No startup snapshot is ever being built; // heap introspection and the serializer refuse, since a page cannot reach V8's. import { refused, refusedClass } from "./refuse"; const WHY = "the page cannot reach V8's internals"; export const v8 = { startupSnapshot: { isBuildingSnapshot: (): number => 0, // Node answers 0, the binding's flag, not false addSerializeCallback: refused("v8", "startupSnapshot.addSerializeCallback", "no snapshot is being built"), addDeserializeCallback: refused("v8", "startupSnapshot.addDeserializeCallback", "no snapshot is being built"), setDeserializeMainFunction: refused("v8", "startupSnapshot.setDeserializeMainFunction", "no snapshot is being built"), }, getHeapStatistics: refused("v8", "getHeapStatistics", WHY), getHeapSpaceStatistics: refused("v8", "getHeapSpaceStatistics", WHY), getHeapSnapshot: refused("v8", "getHeapSnapshot", WHY), writeHeapSnapshot: refused("v8", "writeHeapSnapshot", WHY), setFlagsFromString: refused("v8", "setFlagsFromString", WHY), cachedDataVersionTag: refused("v8", "cachedDataVersionTag", WHY), serialize: refused("v8", "serialize", WHY), deserialize: refused("v8", "deserialize", WHY), getCppHeapStatistics: refused("v8", "getCppHeapStatistics", WHY), getHeapCodeStatistics: refused("v8", "getHeapCodeStatistics", WHY), isStringOneByteRepresentation: refused("v8", "isStringOneByteRepresentation", WHY), queryObjects: refused("v8", "queryObjects", WHY), setHeapSnapshotNearHeapLimit: refused("v8", "setHeapSnapshotNearHeapLimit", WHY), startCpuProfile: refused("v8", "startCpuProfile", WHY), stopCoverage: refused("v8", "stopCoverage", WHY), takeCoverage: refused("v8", "takeCoverage", WHY), GCProfiler: refusedClass("v8", "GCProfiler", WHY), /** Hooks into every promise's lifecycle; nothing here can observe that. */ promiseHooks: { createHook: refused("v8", "promiseHooks.createHook", WHY), onInit: refused("v8", "promiseHooks.onInit", WHY), onBefore: refused("v8", "promiseHooks.onBefore", WHY), onAfter: refused("v8", "promiseHooks.onAfter", WHY), onSettled: refused("v8", "promiseHooks.onSettled", WHY), }, };